Skip to content

Commit b6bf117

Browse files
committed
lint
1 parent f33f079 commit b6bf117

File tree

4 files changed

+25
-43
lines changed

4 files changed

+25
-43
lines changed

app/course/[course_id]/assignments/[assignment_id]/submissions/[submissions_id]/results/page.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -973,9 +973,7 @@ export default function GraderResults() {
973973
const hasBuildError = query.data.data.grader_results.lint_output === "Gradle build failed";
974974
const data = query.data.data;
975975
// Get build output for AI analysis
976-
const buildOutput = data.grader_results?.grader_result_output?.[0]?.output ||
977-
data.grader_results?.lint_output ||
978-
"";
976+
const buildOutput = data.grader_results?.grader_result_output?.[0]?.output || data.grader_results?.lint_output || "";
979977
return (
980978
<Box>
981979
{hasBuildError && (

components/ai-help/AIHelpSubmissionErrorButton.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,7 @@ interface AIHelpSubmissionErrorButtonProps {
3333
* Generates an AI prompt for analyzing a test failure or build error
3434
*/
3535
function generateErrorPrompt(props: AIHelpSubmissionErrorButtonProps): string {
36-
const {
37-
errorType,
38-
testName,
39-
testPart,
40-
score,
41-
maxScore,
42-
errorOutput,
43-
assignmentId,
44-
classId,
45-
submissionId
46-
} = props;
36+
const { errorType, testName, testPart, score, maxScore, errorOutput, assignmentId, classId, submissionId } = props;
4737

4838
const truncatedOutput = errorOutput.slice(0, 4000) + (errorOutput.length > 4000 ? "\n... (truncated)" : "");
4939

@@ -179,13 +169,7 @@ export function AIHelpSubmissionErrorButton(props: AIHelpSubmissionErrorButtonPr
179169

180170
return (
181171
<Tooltip content={tooltipContent} showArrow>
182-
<IconButton
183-
aria-label={tooltipContent}
184-
size="xs"
185-
variant="ghost"
186-
colorPalette="purple"
187-
onClick={handleCopy}
188-
>
172+
<IconButton aria-label={tooltipContent} size="xs" variant="ghost" colorPalette="purple" onClick={handleCopy}>
189173
<Icon as={BsRobot} />
190174
</IconButton>
191175
</Tooltip>

supabase/functions/_shared/MCPAuth.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ async function getSupabaseJwtKey(): Promise<{ key: CryptoKey; kid: string }> {
7474
const secret = Deno.env.get(SUPABASE_JWT_SECRET_ENV);
7575

7676
if (!secret) {
77-
throw new MCPAuthError(`${SUPABASE_JWT_SECRET_ENV} must be set. Generate with: supabase gen signing-key --algorithm ES256`);
77+
throw new MCPAuthError(
78+
`${SUPABASE_JWT_SECRET_ENV} must be set. Generate with: supabase gen signing-key --algorithm ES256`
79+
);
7880
}
7981

8082
if (!secret.startsWith("{")) {
@@ -83,19 +85,19 @@ async function getSupabaseJwtKey(): Promise<{ key: CryptoKey; kid: string }> {
8385

8486
const jwkFull = JSON.parse(secret);
8587
const kid = jwkFull.kid;
86-
88+
8789
if (!kid) {
8890
throw new MCPAuthError("JWK must have a 'kid' field");
8991
}
90-
92+
9193
if (jwkFull.kty !== "EC" || jwkFull.crv !== "P-256") {
9294
throw new MCPAuthError("JWK must be an EC key with P-256 curve (ES256)");
9395
}
94-
96+
9597
if (!jwkFull.d) {
9698
throw new MCPAuthError("JWK must include private key component 'd'");
9799
}
98-
100+
99101
// Create a clean JWK with only the fields needed for import
100102
// Deno's WebCrypto can be strict about extra fields like 'key_ops'
101103
const jwk: Record<string, unknown> = {
@@ -105,15 +107,9 @@ async function getSupabaseJwtKey(): Promise<{ key: CryptoKey; kid: string }> {
105107
y: jwkFull.y,
106108
d: jwkFull.d
107109
};
108-
109-
const key = await crypto.subtle.importKey(
110-
"jwk",
111-
jwk,
112-
{ name: "ECDSA", namedCurve: "P-256" },
113-
false,
114-
["sign"]
115-
);
116-
110+
111+
const key = await crypto.subtle.importKey("jwk", jwk, { name: "ECDSA", namedCurve: "P-256" }, false, ["sign"]);
112+
117113
return { key, kid };
118114
}
119115

supabase/functions/mcp-server/index.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ if (Deno.env.get("SENTRY_DSN")) {
3939
// CORS headers
4040
const corsHeaders = {
4141
"Access-Control-Allow-Origin": "*",
42-
"Access-Control-Allow-Headers": "authorization, x-client-info, apikey, content-type, accept, mcp-session-id, last-event-id",
42+
"Access-Control-Allow-Headers":
43+
"authorization, x-client-info, apikey, content-type, accept, mcp-session-id, last-event-id",
4344
"Access-Control-Allow-Methods": "GET, POST, DELETE, OPTIONS"
4445
};
4546

@@ -668,9 +669,7 @@ async function getDiscussionThread(
668669
const topic = thread.discussion_topics as unknown as { assignment_id: number | null };
669670

670671
// Translate private profile to public profile for author
671-
const authorPublicProfiles = thread.author
672-
? await getPublicProfiles(supabase, [thread.author], classId)
673-
: new Map();
672+
const authorPublicProfiles = thread.author ? await getPublicProfiles(supabase, [thread.author], classId) : new Map();
674673
const authorPublicProfile = thread.author ? authorPublicProfiles.get(thread.author) : null;
675674

676675
// Parallel fetch: assignment, latest submission, replies
@@ -1129,7 +1128,12 @@ function createSSEStream(): { stream: ReadableStream<Uint8Array>; sse: SSEStream
11291128
};
11301129
}
11311130

1132-
function sendSSEEvent(sse: SSEStream, event: string, data: unknown, options: { includeId?: boolean; raw?: boolean } = {}): void {
1131+
function sendSSEEvent(
1132+
sse: SSEStream,
1133+
event: string,
1134+
data: unknown,
1135+
options: { includeId?: boolean; raw?: boolean } = {}
1136+
): void {
11331137
const { includeId = true, raw = false } = options;
11341138
const lines: string[] = [];
11351139
if (includeId) {
@@ -1164,11 +1168,11 @@ function closeSSEStream(sse: SSEStream): void {
11641168
function getEndpointUrl(req: Request): string {
11651169
// Use EDGE_FUNCTIONS_URL as the authoritative base URL
11661170
const edgeFunctionsUrl = Deno.env.get("EDGE_FUNCTIONS_URL");
1167-
1171+
11681172
if (edgeFunctionsUrl) {
11691173
return `${edgeFunctionsUrl}/functions/v1/mcp-server`;
11701174
}
1171-
1175+
11721176
// Fallback: construct from request
11731177
const url = new URL(req.url);
11741178
const proto = req.headers.get("x-forwarded-proto") || "https";
@@ -1233,7 +1237,7 @@ Deno.serve(async (req: Request): Promise<Response> => {
12331237
...corsHeaders,
12341238
"Content-Type": "text/event-stream",
12351239
"Cache-Control": "no-cache",
1236-
"Connection": "keep-alive"
1240+
Connection: "keep-alive"
12371241
}
12381242
});
12391243
} catch (error) {

0 commit comments

Comments
 (0)