Repository navigation
Reliability/fail closed audit - #922
Conversation
…nd monitoring
A reliability audit of fail-dangerous surfaces — places where a failure is
reported as success, or where an error path destroys data the success path
would have kept. Single PR; the runner-side counterparts live in the
assignment-action repo and are unblocked by the server guard here.
Grading correctness (migrations)
- Restore per_student_tweaks to _submission_review_recompute_scores. Three
migrations define this function; the most recent branched from a revision
predating the feature, silently reverting it. The column is still written and
still fires a recompute, so a recompute genuinely runs — it just computes a
total that omits the tweak. Grades have been wrong since that migration.
Re-merged with both zero floors kept, and the floor deliberately applied
after the tweak so a negative tweak cannot store a negative line. Backfills
affected reviews, refusing above a row ceiling rather than taking a long
advisory-lock hold on live grading.
- promote_whatif_grader_result now repoints the promoted result's tests and
recomputes. It previously deleted the old official result and returned
{'promoted': true} without recomputing, and nothing else covered it: the
grader_results recompute trigger was dropped long ago and the
grader_result_tests triggers are INSERT/UPDATE only. Adds a statement-level
AFTER DELETE trigger as a safety net, with a bulk-teardown guard.
- get_async_queue_sizes reports the notification email queue (previously
unreported entirely) plus oldest-message age per queue. Depth thresholds
need retuning against enrollment and the deadline calendar; age does not.
Edge functions
- autograder-submit-feedback preserves an existing result when a failed run
submits nothing gradeable. The reset path deletes every test, output and
workflow_run_error row for the submission before writing the empty payload,
so a real grade was destroyed rather than shadowed.
- getTeamMembers throws on 404 instead of returning [], and collaborator
removal fails closed on an unknown staff roster. That empty list was the only
guard before removing staff from every repo, and it was cached.
- assignment-create-all-repos keeps the repositories row (deleting it hid the
failure from the reconciler), records creation_error only for terminal
failures, and reports real allSettled counts instead of unconditional success.
- Notification email: explicit EMAIL_ENABLED, and SMTP_PASS / SMTP_ADMIN_EMAIL
accepted alongside the older names so one Secret serves GoTrue and the edge
runtime. Missing config now refuses loudly; it previously returned "no work
found", indistinguishable from an empty queue, and deferred forever.
- started guards on the two unguarded queue workers, and a reset on exit for
all four so a worker restarts once its fault clears.
- github-repo-webhook holds latest_autograder_sha / latest_template_sha when
the config reconcile failed, rather than advertising a config never applied.
- Version-mismatch recovery lifted into a helper used by both gradebook paths;
the bulk path previously logged mismatches and left rows stuck recalculating.
- Sentry init extracted to a shared module and imported by four functions that
made Sentry calls against an uninitialized client.
- wrapRequestHandler's catch-all returns 500; it returned 200 with an error body.
Monitoring
- Alert rules for edge-function restarts, OOM kills and memory headroom, Discord
DLQ growth (a rate, not a level), queue age, and the email backlog. Existing
app-queue rules wrapped in max() to match the house convention; certificate
expiry can now watch the ingress namespace, without which it could never match.
- edge-functions dashboard gains a container-health row including memory vs pod
age; new queues-and-workers dashboard pairs depth with oldest-message age.
- Chart mounts the SMTP Secret into the edge runtime, adds EMAIL_ENABLED and an
opt-in requireEnvFromSecrets, and drops maxParallelism to 8 so the admission
budget fits the pod memory limit.
Frontend
- Middleware strips X-User-ID on the failure path and reports the exception. It
forwarded raw headers, and that header is resolved through a service-role
client, so RLS did not catch a forged one.
- Rubric YAML parse returns its warnings; save blocks on negative points instead
of silently persisting -5 as +5, matching the validator the CLI already uses.
- Review toolbar distinguishes "group members not loaded" from "no members"
rather than showing an all-clear on an ungraded review.
- Grade export keeps the first test result per submission; bulk release reports
the RPC's row count instead of the selection size.
Tests: 4 new pure edge-function modules with Deno coverage, 5 new Jest suites,
and 2 Playwright DB specs verified to fail when the fixes are reverted.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VajgWQWjBjbayp3f4yotFq
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis PR updates grading safeguards, rubric validation, bulk-release reporting, SMTP processing, queue monitoring, runtime error handling, repository synchronization, gradebook recovery, webhook reconciliation, and request identity handling. ChangesGrading workflows
Operations and reliability
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 13
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
app/course/[course_id]/manage/assignments/[assignment_id]/rubric/page.tsx (1)
1122-1128: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winThe comment states the opposite of the actual diff behavior.
YamlRubricToHydratedRubricabsolutizes before returning, so a buffer holding-5hydrates to5.currentEditorAsYamlStringthen equalssnapshotAsYamlString,hasUnsavedChangesis set tofalse, and the Save button stays disabled (line 1665). The buffer does not "correctly report as changed".The outcome is defensible, because the save would be rejected anyway. The comment is not. Fix the comment, and consider treating a non-empty warning list as dirty so the tab marker matches what the author sees in the editor.
📝 Suggested comment correction
- // Warnings ignored: this is a pure diff for the unsaved-changes indicator. A buffer holding - // `-5` against a saved `5` correctly reports as changed. + // Warnings ignored: this is a pure diff for the unsaved-changes indicator. Note that the + // parser absolutizes, so a buffer holding `-5` against a saved `5` diffs as UNCHANGED; the + // source-mode "points" banner is what tells the author their value is invalid. const { rubric: currentEditorActiveRubric } = YamlRubricToHydratedRubric(parsedValue, {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/course/`[course_id]/manage/assignments/[assignment_id]/rubric/page.tsx around lines 1122 - 1128, Correct the misleading comment above YamlRubricToHydratedRubric to state that negative values are absolutized during hydration, so a buffer such as -5 may match the saved 5 and not mark the rubric as changed. Do not claim this case correctly reports as changed; optionally update hasUnsavedChanges to treat a non-empty warning list as dirty if that behavior is intended.
🧹 Nitpick comments (12)
supabase/functions/assignment-create-all-repos/index.ts (2)
454-476: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider honoring
removalsSkippedon the creation path too, for consistency with the sync pass.
syncRepoPermissionsat Line 437 now returnsremovalsSkipped, and this path discards it. Line 448 then writesis_github_ready: true. The sync pass at Lines 526-530 refuses to do that, and the comment insupabase/functions/_shared/GitHubWrapper.tsat Lines 3128-3133 states the flag exists precisely to stop a half-done sync from being recorded as complete.The practical risk here is smaller than on the sync pass, because a freshly created repository has no stale collaborators to remove. The asymmetry is the concern: the same flag is authoritative in one branch and ignored in the other, so a later reader cannot tell which rule applies.
♻️ Treat a skipped removal as a creation failure, matching the sync pass
- await github.syncRepoPermissions( + const { removalsSkipped } = await github.syncRepoPermissions( assignment.classes!.github_org!, repoName, assignment.classes!.slug!, github_username, scope ); + // Same rule as the sync pass below: a run that could not read the staff roster did only the + // additive half of the job, so it must not be recorded as ready. The row stays inside + // reconcile_stuck_repo_creations' sweep, and creation_error stays NULL because this is + // retryable. + if (removalsSkipped) { + throw new Error( + `Staff roster unavailable while syncing ${repoName}; collaborator removals were skipped` + ); + } await adminSupabase .from("repositories") .update({ synced_repo_sha: headSha, is_github_ready: true }) .eq("id", dbRepo.id);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/assignment-create-all-repos/index.ts` around lines 454 - 476, Update the repository creation flow around syncRepoPermissions and the subsequent is_github_ready update to honor its removalsSkipped result. Treat any skipped removal as a creation failure and do not mark the repository ready, matching the existing sync-pass behavior while preserving normal completion when no removals were skipped.
526-536: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winCheck the
errorfrom the readiness write, so a failed write is not summarized as a success.The
supabase-jsclient resolves with an{ error }object rather than rejecting. The update at Lines 531-536 does not read it. If that write fails, the callback returns normally,Promise.allSettledrecordsfulfilled, andsyncedSummarycounts the repository as synced whileis_github_readyis stillfalse.
reconcile_stuck_repo_creationsscansis_github_ready = false, so the row is eventually repaired. The reporting is still wrong in the meantime, and accurate reporting is what the rest of this change is for. The same applies to the write at Lines 505-510.♻️ Surface the write failure to the summary
- await adminSupabase + const { error: readyError } = await adminSupabase .from("repositories") .update({ is_github_ready: true }) .eq("id", repo.id); + if (readyError) { + // Rejecting rather than logging: the summary is what the instructor is shown, and a + // repository whose readiness never persisted is not a synced repository. + throw new Error( + `Synced ${repo.repository} but could not record it as ready: ${readyError.message}` + ); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/assignment-create-all-repos/index.ts` around lines 526 - 536, Check and handle the returned error from both repository readiness updates in the assignment synchronization flow, including the write near the removalsSkipped check and the earlier write near lines 505-510. Propagate any write failure so the callback rejects and Promise.allSettled records the repository as failed rather than synced.supabase/functions/_shared/GitHubWrapper.ts (1)
2883-2915: 🚀 Performance & Scalability | 🔵 Trivial | 🏗️ Heavy liftScope missing-team caching to one bulk run
TeamNotFoundErrorcurrently evictsstaffTeamCache, so each repository repeats the members request and Sentry event. Do not retainnullin this module-level cache indefinitely.resolveExistingTeamSlugruns before the staff cache and intentionally retries missing teams. Use a request-scoped cache for both lookups, then share thenullroster only within that run.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/_shared/GitHubWrapper.ts` around lines 2883 - 2915, Change the staff-team lookup flow around staffTeamCache so TeamNotFoundError results are cached only within the current bulk run, not indefinitely in the module-level cache. Add or reuse a request-scoped cache shared by resolveExistingTeamSlug and the staff roster lookup, preserving null as the shared unknown-roster result for that run while allowing later runs to retry missing teams.supabase/functions/autograder-submit-feedback/index.ts (1)
713-787: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAlso record
requestBody.errorson the preserve path.The guard logic and the ordering of
reject_stalebeforepreserveare correct, and the reasoning is well documented.One gap. The early return at Line 776 skips the block at Lines 961-975 that inserts
requestBody.errorsintoworkflow_run_error. Those rows carry the runner's own diagnosis of why the run failed. The student-visible message written at Lines 739-744 tells the student to "Ask your instructor to check the autograder", but the instructor then has only the syntheticempty_grader_result_discardedrow and no runner detail. The preserve path is exactly the case where that detail matters most.Fold the incoming errors into the guard's own record, or insert them before returning.
♻️ Proposed change to keep the runner's diagnostics
await recordWorkflowRunError({ name: "Autograder run produced no results; previous feedback preserved", data: { type: "empty_grader_result_discarded", ret_code: requestBody.ret_code ?? null, grader_sha: requestBody.grader_sha ?? null, - existing_grader_result_id: existingResult.id + existing_grader_result_id: existingResult.id, + runner_errors: (requestBody.errors ?? null) as Json }, is_private: false });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/autograder-submit-feedback/index.ts` around lines 713 - 787, Update the conflictVerdict === "preserve" branch to retain requestBody.errors alongside the synthetic empty_grader_result_discarded workflow error before returning. Reuse the existing workflow_run_error recording mechanism and its established error payload shape, ensuring the runner’s diagnostics are recorded without changing the reject_stale ordering or preserved-result behavior.supabase/functions/_shared/GitHubWrapper.test.ts (1)
426-439: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExercise
staffTeamCachein this regression test.
getTeamMembershas no cache.staffTeamCacheis owned bysyncRepoPermissions, but both direct calls bypass it. Invoke the caching wrapper twice, or narrow the test name and comment to direct retry behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/_shared/GitHubWrapper.test.ts` around lines 426 - 439, Update the regression test around getTeamMembers to exercise staffTeamCache through syncRepoPermissions rather than calling getTeamMembers directly twice, preserving the first-call 404 rejection and successful second-call behavior; alternatively, if testing direct retry behavior is intended, rename the test and revise its comment to remove cache-specific claims.supabase/migrations/20260811130200_gradebook_batch_returns_version.sql (1)
45-61: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the broad exception handler.
pgmq.createis idempotent and usesCREATE TABLE IF NOT EXISTS. Call it directly so permission or naming errors surface at the creation step. The eightservice_rolegrants match the Discord DLQ.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/migrations/20260811130200_gradebook_batch_returns_version.sql` around lines 45 - 61, Remove the do block and broad exception handler around pgmq.create for gradebook_row_recalculate_dlq, calling pgmq.create directly so creation errors propagate. Preserve all eight existing service_role grants unchanged.tests/unit/rubric/parse.test.ts (1)
206-253: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAdd a case for negative option points.
sanitizeCheckPointswarns oncheck.data.options[].points, and that value has no database backstop. The new block coverscheck.pointsandcriteria.total_pointsonly. A test here pins the one warning that the RPC and the CLI validator cannot currently produce.🧪 Suggested additional case
it("reports every offending path, not just the first", () => {Add before the closing
});of the describe block:it("reports a negative option points value", () => { const { rubric, warnings } = YamlRubricToHydratedRubric( { name: "Negative option", parts: [ makePart({ criteria: [ makeCriteria({ checks: [ makeCheck({ data: { options: [{ label: "Good", points: 3 }, { label: "Bad", points: -2 }] } }) ] }) ] }) ] }, { ...ctx } ); const options = (rubric.rubric_parts[0].rubric_criteria[0].rubric_checks[0].data as { options: { points: number }[]; }).options; expect(options[1].points).toBe(2); expect(warnings.some((w) => w.path.includes("options[1].points"))).toBe(true); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/unit/rubric/parse.test.ts` around lines 206 - 253, Add a test in the “YamlRubricToHydratedRubric — negative points” suite covering a negative points value in the second entry of a check’s data.options array. Assert that the value is absolutized to 2 and that warnings include the path for options[1].points, using YamlRubricToHydratedRubric and the existing makeCheck/makeCriteria helpers.tests/manual/rubric_points_non_negative.sql (1)
79-173: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueAdd a scenario for negative option points if the third guard lands.
Scenarios 5 and 6 prove the two new
update_rubric_fullguards by name. There is no scenario for a negativepointsinsidecheck.data.options, which is the case no column CHECK can reach. If you add the guard suggested on the migration, add the matching scenario here so the harness proves all three.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/manual/rubric_points_non_negative.sql` around lines 79 - 173, Add a manual test scenario alongside scenarios 5 and 6 that calls update_rubric_full with a check containing data.options and a negative option points value, then verify it raises the same named validation error rather than a bare constraint violation. Use the existing authenticated setup and savepoint/rollback pattern, and preserve the valid scenario ordering.tests/e2e/submission-review-per-student-tweaks-db.spec.ts (1)
125-145: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConsider asserting
per_student_grading_totalsdirectly.
readReviewalready selectsper_student_grading_totalsandper_student_grading_shared_base, but no test reads either field. Every assertion goes throughtotal_score.The migration applies the tweak twice on different paths: once into the aggregate at line 161, and once into each per-student line at line 324. Only the aggregate path is pinned here. A per-student assertion, especially on the floored case at line 134, would cover the second path and the floor-after-tweak ordering at the line level.
This is optional for this PR.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/e2e/submission-review-per-student-tweaks-db.spec.ts` around lines 125 - 145, Extend the tests around totalWithTweaks to also assert the readReview fields per_student_grading_totals and per_student_grading_shared_base. In particular, verify the floored negative-tweak case produces a zero per-student total, covering the per-student migration path and floor-after-tweak ordering while preserving the existing aggregate assertions.supabase/migrations/20260811120100_promote_whatif_recompute_and_grader_test_delete_trigger.sql (1)
204-213: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winThe bulk cap skips silently.
When a statement touches more than 10 distinct submissions, this returns without recomputing and without any signal.
The comment argues that every legitimate path touches one grader result at a time, and that the paths exceeding the cap are teardowns which delete the reviews shortly afterwards. That reasoning is correct for the callers named. It is enforced only by the comment.
If a future caller deletes tests across many submissions and does not delete the reviews, the scores go stale and nothing reports it. A warning on the skip path would make that observable without changing behavior.
🔧 Proposed change to make the skip observable
IF cardinality(v_submission_ids) > c_max_submissions THEN + RAISE WARNING 'grader_result_tests delete touched % distinct submissions (cap %); skipping recompute. If this was not an assignment teardown, the affected submission_reviews now hold stale autograde scores: %', + cardinality(v_submission_ids), c_max_submissions, v_submission_ids; RETURN NULL; END IF;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/migrations/20260811120100_promote_whatif_recompute_and_grader_test_delete_trigger.sql` around lines 204 - 213, Add a warning log to the cardinality guard in the grader-result deletion trigger, immediately before returning when v_submission_ids exceeds c_max_submissions. Include the submission count and cap in the warning, while preserving the existing RETURN NULL behavior and recomputation flow.hooks/useSubmissionReview.tsx (1)
362-431: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the shared branch ladder.
This hook and
useMissingRubricChecksForReviewAssignmentincomponents/ui/submission-review-toolbar.tsxnow carry the same four-step ladder: no review, no checks, blocked, compute. Each step returns the same five-field object shape.The two copies differ only in scope handling and in which "no review" inputs they test. A shared helper that takes the inputs and a
rubricPartIdsInScopevalue would keep the fail-closed semantics in one place. A future change to one branch will otherwise need a matching edit in the other file, and a missed edit reopens exactly the false all-clear this PR closes.This is optional for this PR.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@hooks/useSubmissionReview.tsx` around lines 362 - 431, Optionally extract the shared no-review, no-checks, blocked, and compute branch ladder from the current hook and useMissingRubricChecksForReviewAssignment into a helper that returns the common five-field result and accepts rubricPartIdsInScope plus each flow’s no-review inputs. Replace both duplicated implementations with the helper while preserving the existing fail-closed semantics and scope-specific computation.supabase/migrations/20260811120000_restore_per_student_tweaks_in_recompute.sql (1)
369-401: 🗄️ Data Integrity & Integration | 🔵 TrivialThe backfill writes rows, so audit partitions must cover today.
_submission_review_recompute_scoresends with anUPDATE public.submission_reviews. That update fires the audit triggers. If no audit partition covers the current date, the update fails and the whole migration aborts.The row ceiling and its rationale are well judged. Please confirm the partition prerequisite is satisfied in the environments where this migration runs, so a partition gap does not surface as a confusing backfill failure.
As per coding guidelines: "After starting Supabase, maintain partitions for the current date by running
public.audit_maintain_partitions(); otherwise inserts outside the migration-defined date range can fail."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/migrations/20260811120000_restore_per_student_tweaks_in_recompute.sql` around lines 369 - 401, The backfill invokes _submission_review_recompute_scores, which updates submission_reviews and requires an audit partition for the current date. Before the backfill loop runs, invoke public.audit_maintain_partitions() so the required partition exists in every environment; keep the existing row ceiling, recomputation loop, and reporting unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/course/`[course_id]/manage/assignments/[assignment_id]/rubric/page.tsx:
- Around line 788-797: Update the sidebar warning configuration used by
setPointsWarnings(parseWarnings) and the related
NEGATIVE_POINTS_WARNING_MESSAGE/title so the banner states that negative point
values are rejected rather than adjusted, matching saveRubric’s
NegativePointsError behavior. Explicitly mention that the preview displays the
absolute value while the original source value remains unchanged and is refused
on save.
In `@charts/pawtograder/tests/render-guardrails.sh`:
- Around line 115-123: Update the mandatory-reference check in
render-guardrails.sh to inspect only optional: false entries under
envFrom.secretRef, excluding the required Redis Secret reference. Preserve the
existing failure message and diagnostic output while preventing non-envFrom
Redis references from setting bad.
In `@components/ui/submission-review-toolbar.tsx`:
- Around line 364-372: The gradeTargetsBlocked result currently conflates
loading with a settled empty group. Update
useMissingRubricChecksForReviewAssignment and both call sites in
components/ui/submission-review-toolbar.tsx at lines 364-372 and 466-476 to
return and consume a loaded/settled indicator alongside the blocked flag; keep
loading disabled only while group data is not loaded, and render an explanatory
disabled button using the server-side empty-group guidance once settled and
blocked.
In `@supabase/functions/assignment-create-all-repos/index.ts`:
- Around line 330-355: Update ensureExistingRepoCreated so both error catch
blocks rethrow after logging and applying any existing scope tags. Preserve the
per-repository isolation provided by Promise.allSettled, allowing ensuredSummary
from summarizeSettled to record failures and reasons instead of treating every
failed operation as fulfilled.
In `@supabase/functions/discord-async-worker/index.ts`:
- Around line 1420-1427: Update the runBatchHandler promise chain to catch and
handle rejections before finally resets started, including failures occurring
before the loop’s try block. Correct the adjacent comment to describe the actual
retry behavior without claiming maxConsecutiveErrors or loop termination.
In `@supabase/functions/github-async-worker/index.ts`:
- Around line 2647-2654: The comment above the EdgeRuntime.waitUntil call
incorrectly describes loop termination, and runBatchHandler rejection is left
unhandled. Reword the comment to describe the actual failure/exit behavior, then
extend the runBatchHandler promise chain to catch and report failures while
retaining the finally callback that resets started.
In `@supabase/functions/github-repo-webhook/index.ts`:
- Around line 2314-2326: Update the handoutTarget query handling in the
assignment reconciliation loop to capture and check its read error separately
from a null target. When the read fails, set configReconcileOk to false, record
the existing failure tag/log context, and continue without advancing the
pointer; preserve the current continue behavior for assignments that genuinely
have no template_repo.
In `@supabase/functions/notification-queue-processor/index.ts`:
- Around line 930-958: Use a cloned Sentry scope for the disabled-path archive
operations in the transport handling block, and pass that isolated scope to each
archiveMessage call. Keep the shared scope for the email_disabled_reason tag and
normal processing so archive_error data cannot persist into later polling
iterations.
- Around line 705-738: Update the transport precheck handling around
transportPrecheck and runBatchHandler so the misconfigured Sentry.captureMessage
event and the later captured exception use the same stable fingerprint. Apply
the fingerprint to the parent scope before throwing, while preserving the
existing diagnostic context; alternatively remove the duplicate message event
and fingerprint only the outer exception.
In
`@supabase/migrations/20260811120000_restore_per_student_tweaks_in_recompute.sql`:
- Around line 311-323: Align the summing loop’s tweak parsing with the
per-student reader by trimming whitespace before converting each shipped string
to numeric, while preserving the existing NaN and out-of-range handling. Update
the summing logic around the loop near line 145; leave the per-student reader
using v_per_student_tweaks unchanged so both paths produce the same totals for
padded values.
In `@supabase/migrations/20260811130300_rubric_points_non_negative.sql`:
- Around line 216-241: Guard negative option points in both non-browser write
paths: in supabase/migrations/20260811130300_rubric_points_non_negative.sql
lines 216-241, add a third pre-write validation that traverses each check’s
data.options entries and raises an error including the check name, matching the
existing negative points wording; in supabase/functions/_shared/rubricYaml.ts
lines 735-756, extend the per-check validation to reject negative points in
every check.data.options entry with the same error behavior.
In `@tests/e2e/promote-whatif-recompute-db.spec.ts`:
- Around line 157-170: Capture the result of the Supabase delete in the
“deleting autograder tests lowers the stored score” test, inspect its error, and
throw or fail with contextual details before calling readAutogradeScore. Follow
the file’s existing error-handling pattern so delete failures are distinguished
from AFTER DELETE trigger failures.
In `@tests/unit/middleware-fail-open.test.ts`:
- Line 70: Update the Sentry assertion in the middleware fail-open test to
verify that the captured exception includes the `middleware-session` feature
tag, while retaining the existing single-call count assertion.
---
Outside diff comments:
In `@app/course/`[course_id]/manage/assignments/[assignment_id]/rubric/page.tsx:
- Around line 1122-1128: Correct the misleading comment above
YamlRubricToHydratedRubric to state that negative values are absolutized during
hydration, so a buffer such as -5 may match the saved 5 and not mark the rubric
as changed. Do not claim this case correctly reports as changed; optionally
update hasUnsavedChanges to treat a non-empty warning list as dirty if that
behavior is intended.
---
Nitpick comments:
In `@hooks/useSubmissionReview.tsx`:
- Around line 362-431: Optionally extract the shared no-review, no-checks,
blocked, and compute branch ladder from the current hook and
useMissingRubricChecksForReviewAssignment into a helper that returns the common
five-field result and accepts rubricPartIdsInScope plus each flow’s no-review
inputs. Replace both duplicated implementations with the helper while preserving
the existing fail-closed semantics and scope-specific computation.
In `@supabase/functions/_shared/GitHubWrapper.test.ts`:
- Around line 426-439: Update the regression test around getTeamMembers to
exercise staffTeamCache through syncRepoPermissions rather than calling
getTeamMembers directly twice, preserving the first-call 404 rejection and
successful second-call behavior; alternatively, if testing direct retry behavior
is intended, rename the test and revise its comment to remove cache-specific
claims.
In `@supabase/functions/_shared/GitHubWrapper.ts`:
- Around line 2883-2915: Change the staff-team lookup flow around staffTeamCache
so TeamNotFoundError results are cached only within the current bulk run, not
indefinitely in the module-level cache. Add or reuse a request-scoped cache
shared by resolveExistingTeamSlug and the staff roster lookup, preserving null
as the shared unknown-roster result for that run while allowing later runs to
retry missing teams.
In `@supabase/functions/assignment-create-all-repos/index.ts`:
- Around line 454-476: Update the repository creation flow around
syncRepoPermissions and the subsequent is_github_ready update to honor its
removalsSkipped result. Treat any skipped removal as a creation failure and do
not mark the repository ready, matching the existing sync-pass behavior while
preserving normal completion when no removals were skipped.
- Around line 526-536: Check and handle the returned error from both repository
readiness updates in the assignment synchronization flow, including the write
near the removalsSkipped check and the earlier write near lines 505-510.
Propagate any write failure so the callback rejects and Promise.allSettled
records the repository as failed rather than synced.
In `@supabase/functions/autograder-submit-feedback/index.ts`:
- Around line 713-787: Update the conflictVerdict === "preserve" branch to
retain requestBody.errors alongside the synthetic empty_grader_result_discarded
workflow error before returning. Reuse the existing workflow_run_error recording
mechanism and its established error payload shape, ensuring the runner’s
diagnostics are recorded without changing the reject_stale ordering or
preserved-result behavior.
In
`@supabase/migrations/20260811120000_restore_per_student_tweaks_in_recompute.sql`:
- Around line 369-401: The backfill invokes _submission_review_recompute_scores,
which updates submission_reviews and requires an audit partition for the current
date. Before the backfill loop runs, invoke public.audit_maintain_partitions()
so the required partition exists in every environment; keep the existing row
ceiling, recomputation loop, and reporting unchanged.
In
`@supabase/migrations/20260811120100_promote_whatif_recompute_and_grader_test_delete_trigger.sql`:
- Around line 204-213: Add a warning log to the cardinality guard in the
grader-result deletion trigger, immediately before returning when
v_submission_ids exceeds c_max_submissions. Include the submission count and cap
in the warning, while preserving the existing RETURN NULL behavior and
recomputation flow.
In `@supabase/migrations/20260811130200_gradebook_batch_returns_version.sql`:
- Around line 45-61: Remove the do block and broad exception handler around
pgmq.create for gradebook_row_recalculate_dlq, calling pgmq.create directly so
creation errors propagate. Preserve all eight existing service_role grants
unchanged.
In `@tests/e2e/submission-review-per-student-tweaks-db.spec.ts`:
- Around line 125-145: Extend the tests around totalWithTweaks to also assert
the readReview fields per_student_grading_totals and
per_student_grading_shared_base. In particular, verify the floored
negative-tweak case produces a zero per-student total, covering the per-student
migration path and floor-after-tweak ordering while preserving the existing
aggregate assertions.
In `@tests/manual/rubric_points_non_negative.sql`:
- Around line 79-173: Add a manual test scenario alongside scenarios 5 and 6
that calls update_rubric_full with a check containing data.options and a
negative option points value, then verify it raises the same named validation
error rather than a bare constraint violation. Use the existing authenticated
setup and savepoint/rollback pattern, and preserve the valid scenario ordering.
In `@tests/unit/rubric/parse.test.ts`:
- Around line 206-253: Add a test in the “YamlRubricToHydratedRubric — negative
points” suite covering a negative points value in the second entry of a check’s
data.options array. Assert that the value is absolutized to 2 and that warnings
include the path for options[1].points, using YamlRubricToHydratedRubric and the
existing makeCheck/makeCriteria helpers.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6bd7d34e-33ca-4aea-a0b1-c46dcb1e255b
📒 Files selected for processing (78)
.design-sync/mocks/useCourseController.ts.design-sync/mocks/useSubmissionReview.tsDEPLOYMENT.mdapp/course/[course_id]/manage/assignments/[assignment_id]/GradingStatusPanel.tsxapp/course/[course_id]/manage/assignments/[assignment_id]/assignmentsTable.tsxapp/course/[course_id]/manage/assignments/[assignment_id]/rubric/page.tsxapp/course/page.tsxcharts/pawtograder/README.mdcharts/pawtograder/dashboards/app-business.jsoncharts/pawtograder/dashboards/edge-functions.jsoncharts/pawtograder/dashboards/queues-and-workers.jsoncharts/pawtograder/examples/externalsecrets/README.mdcharts/pawtograder/examples/values-prod-noeso.yamlcharts/pawtograder/examples/values-prod.yamlcharts/pawtograder/examples/values-staging.yamlcharts/pawtograder/templates/_edge-functions-workload.tplcharts/pawtograder/templates/monitoring-dashboards.yamlcharts/pawtograder/templates/prometheus-rules.yamlcharts/pawtograder/tests/render-guardrails.shcharts/pawtograder/values.yamlcomponents/rubric-editor/validation.tscomponents/ui/submission-review-toolbar.tsxhooks/useCourseController.tsxhooks/useSubmissionReview.tsxlib/bulkReleaseMessage.tslib/groupBySubmissionId.tslib/rubric/index.tslib/rubric/parse.tslib/rubric/pointsSanitize.tslib/rubricGradingCompletion.tssupabase/functions/_shared/GitHubWrapper.test.tssupabase/functions/_shared/GitHubWrapper.tssupabase/functions/_shared/HandlerUtils.test.tssupabase/functions/_shared/HandlerUtils.tssupabase/functions/_shared/SentryInit.tssupabase/functions/_shared/SupabaseTypes.d.tssupabase/functions/_shared/emailTransportConfig.test.tssupabase/functions/_shared/emailTransportConfig.tssupabase/functions/_shared/gradebookVersionMismatch.test.tssupabase/functions/_shared/gradebookVersionMismatch.tssupabase/functions/_shared/graderResultVerdict.test.tssupabase/functions/_shared/graderResultVerdict.tssupabase/functions/_shared/rubricYaml.tssupabase/functions/_shared/settledSummary.test.tssupabase/functions/_shared/settledSummary.tssupabase/functions/assignment-create-all-repos/index.tssupabase/functions/autograder-submit-feedback/index.tssupabase/functions/calendar-sync/index.tssupabase/functions/discord-async-worker/index.tssupabase/functions/discord-discussion-stats-update/index.tssupabase/functions/github-async-worker/index.tssupabase/functions/github-repo-webhook/index.tssupabase/functions/gradebook-column-recalculate/DebugOneRow.tssupabase/functions/gradebook-column-recalculate/index.tssupabase/functions/metrics/index.tssupabase/functions/notification-queue-processor/index.tssupabase/migrations/20260811120000_restore_per_student_tweaks_in_recompute.sqlsupabase/migrations/20260811120100_promote_whatif_recompute_and_grader_test_delete_trigger.sqlsupabase/migrations/20260811120200_queue_metrics_notification_emails_and_age.sqlsupabase/migrations/20260811130000_release_grading_review_only.sqlsupabase/migrations/20260811130100_per_student_completion_fails_closed.sqlsupabase/migrations/20260811130200_gradebook_batch_returns_version.sqlsupabase/migrations/20260811130300_rubric_points_non_negative.sqlsupabase/migrations/20260811130400_gradebook_dlq_queue_metrics.sqltests/e2e/promote-whatif-recompute-db.spec.tstests/e2e/submission-review-per-student-tweaks-db.spec.tstests/manual/gradebook_batch_version_guard.sqltests/manual/per_student_completion_fails_closed.sqltests/manual/rubric_points_non_negative.sqltests/unit/bulk-release-message.test.tstests/unit/middleware-fail-open.test.tstests/unit/rubric-grade-targets.test.tstests/unit/rubric/cli-yaml-mapping.test.tstests/unit/rubric/parse.test.tstests/unit/rubric/serialize.test.tstests/unit/submissions-export-grouping.test.tsutils/supabase/SupabaseTypes.d.tsutils/supabase/middleware.ts
…, and rubric points Repo ensure pass: ensureExistingRepoCreated swallowed both its creation and existence-check failures, so every Promise.allSettled entry settled fulfilled and ensuredSummary.failed was always 0. A run where GitHub 5xx'd on every pre-existing repo reported the same "All repository operations succeeded" as a clean one. Both catches now rethrow; allSettled at the call site still isolates each repository. Grader-config reconcile: a failed handoutTarget read was indistinguishable from an assignment with no handout, so it skipped the reseed while leaving configReconcileOk true and let latest_autograder_sha advance over hashes the config write had already invalidated. Read errors are now separated from the no-template case. Discord and GitHub async workers: nothing consumed the promise handed to waitUntil, so the one error that can end these loops (missing environment variables, thrown before the loop's try) was an unhandled rejection that never reached Sentry. Added .catch, and corrected the restart comments, which claimed a maxConsecutiveErrors cap that only the notification and gradebook processors have. Rubric option points: check and criterion points are guarded in the GUI, the CLI validator, the RPC, and the database, but option points inside rubric_checks.data were guarded only by the browser sanitizer, so the CLI, YAML import, and any direct RPC caller could persist a negative. An option's points become a comment's points on selection, inverting the sign the scoring mode intends. Added a by-name guard to update_rubric_full and option validation to rubricYaml. Source-mode rubric editor: the warning banner reused the tree editor's "Points adjusted" wording while the source path leaves the buffer alone and refuses the save, telling an author the value was fixed and then failing on it. Banner now states the value is rejected and names the preview/source divergence. Review completion buttons: gradeTargetsBlocked collapsed "group still loading" and "group settled and empty", and both call sites rendered a spinner for either, so the settled case span forever with no reason given. Hooks now return gradeTargetsLoaded so each site can render an explanatory disabled button using the wording the completion trigger raises server-side. Notification queue processor: a misconfiguration opened two separately-grouped Sentry issues (a captureMessage plus the thrown error); kept the exception, which carries the same tags. archiveMessage annotated the caller's long-lived scope, so one failed archive stamped archive_error onto every later event from that worker; it now clones. Chart guardrail: the mandatory-envFrom-secretRef assertion scanned the whole manifest for optional: false, so any call site rendering with a non-external redis.provider would have failed on the one mandatory reference the chart intends. Scoped to the secretRef name and excluded pawtograder-redis, avoiding grep -q -v, which is not portable across grep implementations. Tests: assert the Sentry feature tag rather than only the call count, and check the delete error in the trigger test so a failed delete does not read as a trigger that did not fire. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9415a88381
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… idempotent, latch missing-SMTP report Gradebook version-mismatch retry: the claim was released as soon as the retry message was durable, but the retry is enqueued WITH BACKOFF, so the row sat at (dirty = true, is_recalculating = false) for the whole delay window. That is the one state enqueue_gradebook_row_recalculation refuses to enqueue for, so a grade change landing in the window neither queued another pass nor bumped version; the delayed retry then saw no mismatch and committed scores computed from pre-change inputs, clearing dirty. The claim is now held until the retry itself completes, which is what the dead-letter branch in the same function already does and for the same reason. A held claim is the state every queued row is in, and it is self-healing: the gating rules allow re-enqueue while it is set. Removes groupVersionScopedClears and its tests, which existed only to scope the release that is no longer performed. Workflow run errors: recordWorkflowRunError used a bare insert against a table with UNIQUE (repository_id, run_number, run_attempt, name), on paths a client legitimately retries. A network retry of the same feedback request raised 23505, and the throw replaced the real outcome with the recording failure -- the preserved-result path returned 500 before completing the check run, so the retry could not converge and the check spun for the rest of the run's life. Now upserts with ignoreDuplicates; recording the same error twice conveys nothing. Missing-SMTP report: the deferred branch returns false, so the loop slept 15s and re-reported indefinitely -- four events per minute per isolate, and the edge tier runs ~12 replicas. The fingerprint collapses these into one issue but every event still bills against the quota. Latched per isolate, so a persistent missing Secret reports once per pod rather than once per poll; the per-poll console warning is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 94121b68a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
lib/rubric/pointsSanitize.ts (1)
20-27: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUse
NEGATIVE_POINTS_REJECTED_MESSAGEinNegativePointsError.
NegativePointsErrorbuilds its message from a second hard-coded string. The source-editor-specific constant is not used by the save or GUI-switch path.app/course/[course_id]/manage/assignments/[assignment_id]/rubric/page.tsxdisplaysNegativePointsError.message, so the new constant currently has no effect. Keep one message source. (raw.githubusercontent.com)Proposed fix
- "Point values cannot be negative. Fix these before saving:\n" + + NEGATIVE_POINTS_REJECTED_MESSAGE + + "\n\nLocations:\n" + warnings.map((w) => ` \u2022 ${w.path}`).join("\n") + - "\nFor deductions, set the criterion scoring mode to deduct-from-total or deduction-only."Also applies to: 40-41
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/rubric/pointsSanitize.ts` around lines 20 - 27, Update the NegativePointsError constructor to build its error message from NEGATIVE_POINTS_REJECTED_MESSAGE, preserving the dynamic warning paths and existing deduction guidance while removing the duplicate hard-coded message source. Ensure all consumers of NegativePointsError.message receive the shared constant’s message.Source: MCP tools
supabase/migrations/20260811130300_rubric_points_non_negative.sql (2)
567-715: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftPropagate option-point changes to existing grades.
When
data.options[*].pointschanges butrubric_checks.pointsdoes not, existing option comments andsubmission_reviews.total_scoreremain stale. Track the selected option safely, or recompute affected comments without overwriting manual scores. Add a regression test with two options and an existing graded review.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/migrations/20260811130300_rubric_points_non_negative.sql` around lines 567 - 715, Extend the rubric_checks upsert logic to detect changes to data.options[*].points even when rubric_checks.points is unchanged, tracking affected checks and selected options safely. Propagate those changes to existing option comments and recompute affected submission_reviews.total_score without overwriting manually assigned scores. Add a regression test covering two options and an existing graded review.Source: MCP tools
57-65: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winReject non-finite
rubric_checks.pointsvalues at the database boundary.
rubric_checks.pointsisnumeric, soNaNandInfinitysatisfypoints >= 0and bypass the< 0scans. A directupdate_rubric_fullcall can persist them and cascade invalid values into comments and score recomputation. Add finite checks to the check and option scans and tochk_rubric_checks_points_non_negative, such aspoints >= 0 AND points < 'Infinity'::numeric.-Infinityis already rejected by< 0.rubric_criteria.total_pointsisbigint, so its constraint does not need a special-value clause.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/migrations/20260811130300_rubric_points_non_negative.sql` around lines 57 - 65, Update the rubric points migration’s option scans, check scans, and chk_rubric_checks_points_non_negative constraint to reject non-finite values by requiring points to be below numeric Infinity in addition to being non-negative. Preserve the existing negative-value handling; do not add special-value logic to the rubric_criteria.total_points bigint constraint.Source: MCP tools
supabase/functions/github-repo-webhook/index.ts (1)
2331-2341: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winDo not treat benign handout skips as reconciliation failures.
seedHandoutFileHashesreturnsseeded: falseforno_commit_shaandno_submission_files. These are missing-input states, not database, parsing, or GitHub failures.This branch sets
configReconcileOk = falsefor everyseeded: falseresult. An assignment with atemplate_repobut nolatest_template_sha, or a valid configuration with no submission files, will therefore holdlatest_autograder_shaeven after the configuration writes succeed. Each later push repeats the hold until the missing input changes.Use an explicit
skippedversusfailedresult, or exempt these benign reasons. Keep the pointer guard for actual reseeding failures. Add regression tests for both benign states and for an actual seed failure.Proposed guard
- if (!seedResult.seeded) { + const benignSeedSkip = + seedResult.reason === "no_commit_sha" || seedResult.reason === "no_submission_files"; + if (!seedResult.seeded && !benignSeedSkip) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/github-repo-webhook/index.ts` around lines 2331 - 2341, Update the reconciliation branch around seedHandoutFileHashes so seeded:false results with reasons no_commit_sha or no_submission_files are treated as benign skips and do not set configReconcileOk to false. Preserve the configReconcileOk=false pointer guard for actual reseeding failures, and add regression coverage for both benign reasons plus a genuine seed failure.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@lib/rubric/pointsSanitize.ts`:
- Around line 20-27: Update the NegativePointsError constructor to build its
error message from NEGATIVE_POINTS_REJECTED_MESSAGE, preserving the dynamic
warning paths and existing deduction guidance while removing the duplicate
hard-coded message source. Ensure all consumers of NegativePointsError.message
receive the shared constant’s message.
In `@supabase/functions/github-repo-webhook/index.ts`:
- Around line 2331-2341: Update the reconciliation branch around
seedHandoutFileHashes so seeded:false results with reasons no_commit_sha or
no_submission_files are treated as benign skips and do not set configReconcileOk
to false. Preserve the configReconcileOk=false pointer guard for actual
reseeding failures, and add regression coverage for both benign reasons plus a
genuine seed failure.
In `@supabase/migrations/20260811130300_rubric_points_non_negative.sql`:
- Around line 567-715: Extend the rubric_checks upsert logic to detect changes
to data.options[*].points even when rubric_checks.points is unchanged, tracking
affected checks and selected options safely. Propagate those changes to existing
option comments and recompute affected submission_reviews.total_score without
overwriting manually assigned scores. Add a regression test covering two options
and an existing graded review.
- Around line 57-65: Update the rubric points migration’s option scans, check
scans, and chk_rubric_checks_points_non_negative constraint to reject non-finite
values by requiring points to be below numeric Infinity in addition to being
non-negative. Preserve the existing negative-value handling; do not add
special-value logic to the rubric_criteria.total_points bigint constraint.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6efcc0e5-7aa6-4ff5-b1ed-99520441cc04
📒 Files selected for processing (20)
.design-sync/mocks/useSubmissionReview.tsapp/course/[course_id]/manage/assignments/[assignment_id]/rubric/page.tsxcharts/pawtograder/tests/render-guardrails.shcomponents/ui/submission-review-toolbar.tsxhooks/useSubmissionReview.tsxlib/rubric/index.tslib/rubric/pointsSanitize.tssupabase/functions/_shared/gradebookVersionMismatch.test.tssupabase/functions/_shared/gradebookVersionMismatch.tssupabase/functions/_shared/rubricYaml.tssupabase/functions/assignment-create-all-repos/index.tssupabase/functions/autograder-submit-feedback/index.tssupabase/functions/discord-async-worker/index.tssupabase/functions/github-async-worker/index.tssupabase/functions/github-repo-webhook/index.tssupabase/functions/gradebook-column-recalculate/index.tssupabase/functions/notification-queue-processor/index.tssupabase/migrations/20260811130300_rubric_points_non_negative.sqltests/e2e/promote-whatif-recompute-db.spec.tstests/unit/middleware-fail-open.test.ts
💤 Files with no reviewable changes (2)
- supabase/functions/_shared/gradebookVersionMismatch.test.ts
- supabase/functions/_shared/gradebookVersionMismatch.ts
🚧 Files skipped from review as they are similar to previous changes (13)
- tests/e2e/promote-whatif-recompute-db.spec.ts
- lib/rubric/index.ts
- .design-sync/mocks/useSubmissionReview.ts
- supabase/functions/_shared/rubricYaml.ts
- tests/unit/middleware-fail-open.test.ts
- charts/pawtograder/tests/render-guardrails.sh
- supabase/functions/github-async-worker/index.ts
- app/course/[course_id]/manage/assignments/[assignment_id]/rubric/page.tsx
- supabase/functions/autograder-submit-feedback/index.ts
- components/ui/submission-review-toolbar.tsx
- supabase/functions/assignment-create-all-repos/index.ts
- supabase/functions/notification-queue-processor/index.ts
- hooks/useSubmissionReview.tsx
|
🧹 Preview torn down — namespace |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
…hen email is disabled Staff team roster: a 404 from the team-members endpoint was treated as one thing, but it covers two very different states. A team that does not exist is a stable configuration (a course whose staff team was never created) and degrading to "remove nobody" is correct for it. A team that exists whose members could not be read is transient, and degrading there skipped every removal while the caller recorded success -- so a student dropped from the course kept write access with nothing scheduled to retry. getTeamMembers now probes the team itself to tell them apart, raising TeamNotFoundError only when the team is genuinely absent and the new TeamMembersUnreadableError otherwise, including when the probe itself is inconclusive. syncRepoPermissions degrades on the former and aborts on the latter. This is what makes the callers correct without each having to interpret a partial result: removalsSkipped is inspected by only one of the ~13 syncRepoPermissions call sites, so the transient case had to fail closed inside the wrapper. Failing closed does not break courses without a staff team, because those still take the degrade path. Notification digests: the explicit-disable branch archived queue messages but left pending discussion_digest_items behind. Items are materialized below that early return, so none accumulate while email is off; what survives is the set materialized before the switch was flipped, whose flush is gated on a one-hour window. Those rows have no queue message left to archive, so nothing else collects them and re-enabling after a long disable delivered a digest assembled from content that old. Now purged alongside the archive, scoped to the user/class combinations in the batch so one class's disable cannot discard another's pending digest. A purge failure reports rather than throws, degrading to the previous behavior instead of re-delivering already-archived messages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ints at the table level Archive failures were invisible. supabase-js resolves an RPC error rather than rejecting, so archiveMessage's try/catch never saw one: every archive "succeeded", the disabled-email path logged that it had suppressed the whole batch and reported work done, and the messages were still queued with visibility pushed an hour out -- a backlog the queue-size metric cannot see either, since it counts only vt <= now(). archiveMessage now checks the error field and returns whether it archived, and the disabled path reports an incomplete suppression instead of claiming success. It also skips the digest purge in that case, so a partial suppression does not discard digest content on top of messages it failed to remove. SMTP auth is now omitted when there are no credentials. resolveEmailTransport deliberately returns ready with empty user/pass for the credential-free relays it supports (Inbucket locally, an IP-allowlisted relay in production), but an auth object was passed unconditionally, so nodemailer attempted LOGIN. Against a relay that merely advertises AUTH as optional that authenticates with an empty username and password rather than sending anonymously, failing every message. Option points are now enforced at the table level, not only in update_rubric_full. The RPC guard and the YAML validator cover the editor and the CLI import, but not the path `assignments copy` takes: cli/utils/rubric.ts INSERTs rubric_checks directly, data included, so a legacy rubric holding a negative option copied through unchanged. A CHECK cannot contain the subquery that walking a jsonb array needs, so the predicate lives in an IMMUTABLE, PARALLEL SAFE, pure function. Non-numeric junk is tolerated deliberately: it is unreachable through every writer, and raising from a CHECK would make a malformed legacy row un-updatable. NOT VALID, matching the two column constraints beside it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… parts in the completion blocker Preserved grader results were displayed as errors. The empty-run guard writes a student-visible message to grader_results.errors to say the run was discarded and the previous results kept, but every view that reads that column tested it for truthiness alone and rendered "Error" in place of the score -- studentDashboard, the assignment page, and the submission history table. The guard therefore preserved the score and then hid it, which is the opposite of its purpose. The payload now carries is_warning, and a single reader in lib/graderResultStatus.ts knows about it. Unmarked payloads, which is every payload written before now, stay failures, so the default is unchanged and only the explicit marker opts out. perStudentEvaluationBlocked disagreed with the completion calculation. It blocked whenever any scoped part had is_assign_to_student, while computeRubricGradingCompletion and validate_review_assignment_completion both treat such a part as SKIPPED when rubric_part_student_assignments holds no value for it. A review containing only standard requirements plus a skipped assigned-student part was therefore completable on the server and permanently disabled in the UI -- the never-resolving button this blocker was added to remove, not create. It now reads the same assignment map, via the same partAssignToStudentSkipped helper, so the two cannot drift. is_individual_grading is unaffected: it has no per-part opt-out and still blocks regardless of the map. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
supabase/functions/_shared/GitHubWrapper.ts (1)
2955-2975: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winSkip the staff-team grant when the staff roster is unavailable.
At Line 2967,
TeamNotFoundErrorlets the sync continue.resolveExistingTeamSlugretains the missing slug. The later staff-team access request then uses that slug and receives a GitHub 404. The function therefore fails before it returnsremovalsSkipped: true.Track the unavailable-team state. Skip the staff-team access grant when that state is set. Continue the additive collaborator work and return
removalsSkipped: true.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/_shared/GitHubWrapper.ts` around lines 2955 - 2975, Track a staff-roster-unavailable state when the TeamNotFoundError branch in the surrounding sync flow is taken, rather than allowing the retained slug to trigger a later 404. Use that state to skip the staff-team access grant while continuing additive collaborator processing, and ensure the function returns removalsSkipped: true for this path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@supabase/functions/_shared/GitHubWrapper.ts`:
- Around line 2955-2975: Track a staff-roster-unavailable state when the
TeamNotFoundError branch in the surrounding sync flow is taken, rather than
allowing the retained slug to trigger a later 404. Use that state to skip the
staff-team access grant while continuing additive collaborator processing, and
ensure the function returns removalsSkipped: true for this path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4eed20ea-7463-41d8-89c3-c098821d7f6c
📒 Files selected for processing (14)
app/course/[course_id]/assignments/[assignment_id]/page.tsxapp/course/[course_id]/assignments/[assignment_id]/submissions/[submissions_id]/layout.tsxapp/course/[course_id]/studentDashboard.tsxcomponents/ui/submission-review-toolbar.tsxhooks/useSubmissionReview.tsxlib/graderResultStatus.tslib/rubricGradingCompletion.tssupabase/functions/_shared/GitHubWrapper.test.tssupabase/functions/_shared/GitHubWrapper.tssupabase/functions/autograder-submit-feedback/index.tssupabase/functions/notification-queue-processor/index.tssupabase/migrations/20260811130300_rubric_points_non_negative.sqltests/unit/grader-result-status.test.tstests/unit/rubric-grade-targets.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- lib/rubricGradingCompletion.ts
- hooks/useSubmissionReview.tsx
- supabase/functions/notification-queue-processor/index.ts
- supabase/functions/_shared/GitHubWrapper.test.ts
- components/ui/submission-review-toolbar.tsx
- supabase/functions/autograder-submit-feedback/index.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b7cc0fb0d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ected hash-seed skips as failures
Digest purge was scoped to the wrong set. It derived the user/class combinations
from the notifications in the current batch, but a digest item's queue message is
archived at the moment the item is materialized -- so a pending digest has no
message left in the queue and never appears in a batch. If a pending digest was the
only remaining work, the read returned nothing and the purge did not run at all.
The scoping rationale was also wrong: EMAIL_ENABLED is a process-wide environment
variable, so there is no per-class disable whose blast radius needed containing.
Every pending digest predates the switch and none may be delivered, so the purge is
now unscoped.
Handout hash seeding: seedHandoutFileHashes returns { seeded: false } for three
states that are not failures -- no_template_repo, no_commit_sha, and
no_submission_files. All three are steady states of a healthy assignment, where
there is no comparable file set and producing no hash rows is correct. Treating
them as reconcile failures pinned latest_autograder_sha on every subsequent
grader-config push for such an assignment and raised an incident each time, for a
config that had been saved correctly. The distinction now lives next to the returns
as isExpectedHandoutSeedSkip, so callers cannot re-derive it wrongly; only a real
hashing or persistence failure holds the pointer.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 412bfc062b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…finite per-student tweaks The empty-run guard could downgrade a real failure. It writes its warning payload to grader_results.errors unconditionally, so a result that already carried a genuine error -- a prior attempt that inserted the row and then failed partway, for instance -- had that error replaced by one marked is_warning. The readers added alongside the marker then classify the result as successful and put its partial score back in front of students as final. The existing payload is now read and the warning is only written over an absent or already-warning value; the discarded run is still recorded through the workflow_run_error and Sentry paths, which run either way. Per-student tweaks accepted infinities. Postgres parses 'Infinity' and '-Infinity' as valid numeric input, so they raise neither caught exception and do not equal NaN. An entry containing one flowed into the score, and least(Infinity, assignment_total_points) then returns the assignment total -- silently awarding full marks under cap_score_to_assignment_points, which is precisely the NaN failure the surrounding guard was written for. Uncapped, an infinite total is stored instead. Both readers now neutralise them alongside NaN. The failure predicate is duplicated for Deno in supabase/functions/_shared rather than shared, because lib/ is reached through the @/ alias, which does not resolve under Deno. Both copies cross-reference each other. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@supabase/functions/_shared/graderResultStatus.ts`:
- Around line 14-17: Update graderResultErrorsIndicateFailure to treat only null
and undefined errors as absent, replacing the broad falsy check while preserving
the existing failure behavior for all other payloads. Add regression coverage
for false, 0, and empty-string JSON values to ensure they are handled as
failures.
In `@supabase/functions/_shared/handoutFileHashes.ts`:
- Around line 136-145: Update seedHandoutFileHashes to return a discriminated
result that uses skipReason exclusively for allowlisted expected skips and
failureReason or error for caught exceptions, preventing exception messages from
being classified as skips by isExpectedHandoutSeedSkip. Update
github-repo-webhook to advance latest_autograder_sha only for genuine expected
skips, and add a test covering an exception whose message matches an allowlisted
reason.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9f3e00de-1610-4d6e-a0d9-6d14cf7a278a
📒 Files selected for processing (7)
lib/graderResultStatus.tssupabase/functions/_shared/graderResultStatus.tssupabase/functions/_shared/handoutFileHashes.tssupabase/functions/autograder-submit-feedback/index.tssupabase/functions/github-repo-webhook/index.tssupabase/functions/notification-queue-processor/index.tssupabase/migrations/20260811120000_restore_per_student_tweaks_in_recompute.sql
🚧 Files skipped from review as they are similar to previous changes (5)
- lib/graderResultStatus.ts
- supabase/functions/autograder-submit-feedback/index.ts
- supabase/functions/notification-queue-processor/index.ts
- supabase/migrations/20260811120000_restore_per_student_tweaks_in_recompute.sql
- supabase/functions/github-repo-webhook/index.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 176c2c6c34
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ain-and-exit The module-level `started` flag never bounded anything in production. It stops a second poll loop only if the isolate is reused, which is `per_worker`; every deployed values file sets `edgeFunctions.policy: per_request`, chosen so a burst cannot pile concurrent requests onto one shared V8 heap. Under `per_request` each poke arrives on a fresh isolate with the flag back to false, so the check could never fire, and each poke parked another infinite loop under waitUntil. An infinite loop holds its isolate and one of the maxParallelism admission slots until the runtime retires it at worker.timeoutMs (400s, beforeUnload at 50%). At one poke per 30s that is roughly 7 concurrent loops per worker steady-state and about 13 at the hard limit, across four workers, against maxParallelism 8 -- the edge tier ran out of slots as a function of uptime rather than load. What needed protecting was resources, not correctness: pgmq_public.read already sets vt on every message it returns, so two workers cannot be handed the same one. So both available shapes are safe, and _shared/workerRun.ts picks between them. With Redis configured, one long-lived drainer holds a renewable lease across the whole fleet; lowest latency, one slot per worker. Without Redis -- unset, unreachable, or a failed acquire -- the poke drains until idle or a 50s budget expires and then returns, holding no slot between pokes and trading idle latency for it. Failing toward bounded is deliberate: guessing wrong yields "slower", never another unbounded loop. Reverting policy to per_worker would have made the old guard correct with no code change, and was rejected because it reintroduces the shared-heap pile-up per_request exists to avoid. `started` is kept as a same-isolate short-circuit, with its comments corrected -- they previously asserted it prevented exactly the accumulation it could not see. The trade-off is documented at the top of workerRun.ts and beside `policy` in values.yaml, where an operator changing either will meet it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ts; tighten two predicates The digest purge was still unreachable. The previous commit corrected its scope but not its position: it sat inside `if (result.data && result.data.length > 0)`, and a pending digest has no queue message left (the message is archived when the item is materialized), so when a digest is the only remaining work `read` returns an empty batch and the purge never ran -- exactly the case it exists for. The whole explicit-disable branch now sits above that check, archiving whatever the read returned, which is a no-op for an empty batch. An empty batch with nothing purged still reports no work, so the idle sleep is unaffected. Non-finite points passed every guard. Postgres numeric admits NaN and the infinities and orders NaN ABOVE every real number, so `NaN >= 0` and `Infinity >= 0` are both true and the new column CHECKs admitted them. The option predicate was worse: it used `v_points = v_points` to exclude NaN, an IEEE idiom that does not hold for Postgres numeric, where NaN = NaN is TRUE -- so that test was a no-op, and neither NaN nor Infinity is caught by `< 0` either. All three constraints now name the non-finite values explicitly. NaN poisons every sum it reaches and least(Infinity, total_points) silently returns the cap, so these are worse than the negatives the constraints were written for. graderResultErrorsIndicateFailure treated `false`, `0` and `""` as "no errors", because it tested `!errors`. The contract is that anything other than the explicit warning marker is a failure, so a malformed falsy payload bypassed failure handling instead of being one. Nullish-only now, in both the Deno and Next copies, with regressions. seedHandoutFileHashes returned caught exception messages through the same `reason` field as its expected skips, so an error whose message read "no_commit_sha" would have been classified as a skip and let the grader-config pointer advance over hashes that were never rebuilt. Skips and failures are now separate fields on a discriminated result, making the collision unrepresentable rather than filtered. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Private repos in a free GitHub org 403 every rulesets endpoint with "Upgrade to GitHub Pro...". Only the create/update/delete path handled that; the list call hit it first and logged a warning plus a Sentry event, then fell through to a create gated by the same plan. Extract isBranchProtectionUnsupportedError, which also reads the message off the response body and errors[], and use it on both paths. The list path now returns early with a plain log and a scope tag. Genuine permission and transport failures still warn and report. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38ddffdf2e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…h loop Two defects in the lease added in 7ce5138, both of which let a second worker loop exist -- the exact outcome the lease was introduced to prevent. Renewal did not check ownership. `SET key token PX ttl XX` asserts only that the key EXISTS; it never compares the stored value. So once a lease had expired and another isolate had acquired the key, the old worker's renewal overwrote the new owner's token and left its own `lost` flag false. Both loops then continued, each stomping the other's token, potentially alternating ownership indefinitely. Renewal and release are now atomic compare-and-act Lua scripts. `eval(script, keys[], args[])` is portable across both backends because the ioredis compat proxy in Redis.ts translates that array form to ioredis's positional form, which is what BottleneckRedisMetrics already relies on. Renewal only ran between batches. The loop awaits processBatch, and some batches are genuinely long -- github-async-worker notes that sync_repo_to_handout can take minutes, against a 60s TTL. A heartbeat that fires only between iterations therefore let the lease lapse mid-batch, after which a later cron poke started another long-lived worker; repeated slow batches would rebuild the admission-slot exhaustion the lease exists to stop. Renewal now runs on an independent timer armed at acquire and cleared on release, so it continues while a batch is in flight. heartbeat() stays as a cheap check for callers that drive time themselves. Losing the lease, or failing to renew it, stops the loop rather than reclaiming the key: reclaiming is how the alternating-ownership case arises. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
supabase/functions/_shared/GitHubWrapper.ts (1)
2910-2917: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winHandle
removalsSkippedin all permission-sync callers.When
getTeamMembersraisesTeamNotFoundError,syncRepoPermissionsadds access but skips collaborator removals. Existing-repository paths ingithub-user-sync,autograder-create-repos-for-student, andgithub-async-workerignore this result; some then treat the repository as synchronized. Propagate the flag or document why each caller is safe.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/_shared/GitHubWrapper.ts` around lines 2910 - 2917, Update all callers of syncRepoPermissions, especially github-user-sync, autograder-create-repos-for-student, and github-async-worker, to inspect and propagate or explicitly handle the returned removalsSkipped flag. Ensure existing-repository flows do not report synchronization as complete when collaborator removals were skipped, or document the concrete safety rationale at each caller.
🧹 Nitpick comments (1)
supabase/functions/_shared/workerRun.test.ts (1)
156-164: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winThis assertion cannot fail, because renewal never calls
set.
renewissuesredis.eval(RENEW_IF_OWNED, ...). It never callsredis.set.setCallstherefore stays atafterAcquirewhether or not the heartbeat fired, so the test passes even if the interval guard is removed. Add anevalCallscounter tofakeRedisand assert on that instead.The same gap affects the timer test at Lines 201-215:
shouldContinue()is alreadytruebeforefireAll(), so that assertion also holds when the timer never fires. AnevalCallscounter fixes both.🥕 Proposed fix: count eval calls in the fake
function fakeRedis(opts: { failAcquire?: boolean; failRenew?: boolean } = {}) { const store = new Map<string, string>(); let setCalls = 0; + let evalCalls = 0; return { store, get setCalls() { return setCalls; }, + get evalCalls() { + return evalCalls; + },eval(script: string, keys: any[], args: any[]) { + evalCalls++; if (opts.failRenew && script.includes("PEXPIRE")) throw new Error("redis down");Deno.test("heartbeat is a no-op before the interval elapses", async () => { const redis = fakeRedis(); let t = 0; const run = await beginWorkerRun({ ...base, redis, leaseTtlMs: 300, now: () => t }); - const afterAcquire = redis.setCalls; + const afterAcquire = redis.evalCalls; t += 10; // well inside ttl/3 await run!.heartbeat(); - assertEquals(redis.setCalls, afterAcquire); + assertEquals(redis.evalCalls, afterAcquire, "no renewal may be issued before ttl/3"); });assertEquals(timers.active, 1, "a renewal timer must be armed on acquire"); + const beforeFire = redis.evalCalls; timers.fireAll(); // stands in for a renewal landing mid-batch await Promise.resolve(); + assertEquals(redis.evalCalls, beforeFire + 1, "the timer must issue a renewal"); assertEquals(run!.shouldContinue(), true);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@supabase/functions/_shared/workerRun.test.ts` around lines 156 - 164, Update fakeRedis and the heartbeat tests around beginWorkerRun to count redis.eval invocations via an evalCalls counter. Replace the no-op heartbeat assertion’s setCalls checks with evalCalls, and update the timer test to assert evalCalls changes only after fireAll(), ensuring both tests fail if renewal or timer execution is removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@supabase/functions/notification-queue-processor/index.ts`:
- Around line 814-833: Prevent digest purging after any incomplete email
suppression by adding a module-level suppressionIncomplete latch near the
existing per-isolate flags. Set it when the archiveFailures branch in the
batch-processing flow detects failed archives, and require it to remain false
before allowing either purge site to execute, including subsequent empty-batch
iterations; preserve the existing failure reporting and ensure the latch is not
reset during the isolate’s lifetime.
---
Outside diff comments:
In `@supabase/functions/_shared/GitHubWrapper.ts`:
- Around line 2910-2917: Update all callers of syncRepoPermissions, especially
github-user-sync, autograder-create-repos-for-student, and github-async-worker,
to inspect and propagate or explicitly handle the returned removalsSkipped flag.
Ensure existing-repository flows do not report synchronization as complete when
collaborator removals were skipped, or document the concrete safety rationale at
each caller.
---
Nitpick comments:
In `@supabase/functions/_shared/workerRun.test.ts`:
- Around line 156-164: Update fakeRedis and the heartbeat tests around
beginWorkerRun to count redis.eval invocations via an evalCalls counter. Replace
the no-op heartbeat assertion’s setCalls checks with evalCalls, and update the
timer test to assert evalCalls changes only after fireAll(), ensuring both tests
fail if renewal or timer execution is removed.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4ad53cab-8c7b-4b57-9909-25b67bbc484f
📒 Files selected for processing (20)
charts/pawtograder/values.yamllib/graderResultStatus.tssupabase/functions/_shared/GitHubWrapper.tssupabase/functions/_shared/branchProtection.tssupabase/functions/_shared/graderResultStatus.tssupabase/functions/_shared/handoutFileHashes.test.tssupabase/functions/_shared/handoutFileHashes.tssupabase/functions/_shared/workerRun.test.tssupabase/functions/_shared/workerRun.tssupabase/functions/assignment-create-handout-repo/index.tssupabase/functions/assignment-create-solution-repo/index.tssupabase/functions/discord-async-worker/index.tssupabase/functions/github-async-worker/index.tssupabase/functions/github-repo-configure-webhook/index.tssupabase/functions/github-repo-webhook/index.tssupabase/functions/gradebook-column-recalculate/index.tssupabase/functions/notification-queue-processor/index.tssupabase/migrations/20260811130300_rubric_points_non_negative.sqltests/unit/branch-protection-rules.test.tstests/unit/grader-result-status.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
- tests/unit/grader-result-status.test.ts
- supabase/functions/_shared/graderResultStatus.ts
- charts/pawtograder/values.yaml
- supabase/functions/github-repo-webhook/index.ts
- supabase/functions/gradebook-column-recalculate/index.ts
- supabase/migrations/20260811130300_rubric_points_non_negative.sql
…n on the next poll The "do not purge digest items when an archive failed" guard survived exactly one iteration. Its branch reports work-done, so runBatchHandler skips the idle sleep and calls processBatch again immediately -- and on that pass the un-archived messages are invisible, because the read that returned them already set vt = now() + 3600. The batch therefore looks empty, no failure is observed, and control fell straight through to the unscoped digest delete. The digests were purged anyway, milliseconds later, which is exactly what the guard's own comment says must not happen: the suppression was still incomplete and now the content was gone too. The state has to outlive the iteration that set it, so it is now a per-isolate latch alongside the missing-SMTP report. Deliberately never cleared: the un-archived messages stay hidden behind their visibility timeout for an hour, so nothing this isolate can observe proves the suppression completed, and a fresh pod re-evaluates from scratch. Gating on "a non-empty batch archived cleanly" was rejected as the alternative: a pending digest has no queue message left at all, so that condition is false in precisely the case the purge was added for. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7615853b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary by CodeRabbit
New Features
Bug Fixes
Documentation