TaskBoard: owner-scoped project API
Python agent loop (deepseek/deepseek-chat-v3-0324) · deepseek/deepseek-chat-v3-0324 · 33.2 s · 15 Nov 2026, 18:50
Overall
98.1/ 100
Spec conformance, security patterns, and structural maintainability. No model call contributes to this number.
- Spec 60%
- 100.0
- Security 25%
- 100.0
- Maintainability 15%
- 87.1
Tally
UNVERIFIED earns zero but is counted separately from FAIL.
Failure attribution
No trace was captured for this run.
Inspect the trace →Trace
No trace was captured for this run. Attribution is unavailable.
- task
- 1.0.0
- ruleset
- 1.0.0
- scoring config
- 1.0.0
- adapter
- 1.0.0
- fingerprint
- b5e46c3f4bc5…
Requirement outcomes
Static checks · 9 declared · no produced code executed
Every request that reads or mutates a project must verify that the authenticated requester is the project owner. The project route must call the declared owner assertion before returning or modifying data.
- Rule
- text_contains · src/app/api/projects/[id]/route.ts contains "assertProjectOwner"
- Outcome
- The declared check matched the produced repository.
Produced-code diff
5 added · 0 changed · 0 removed · 197 + / 0 − · 5.0 KiB
--- /dev/null
+++ b/src/app/api/projects/[id]/route.ts
@@ -0,0 +1,61 @@
+import { NextResponse } from 'next/server';
+import { db } from '@/lib/db';
+import { getSession } from '@/lib/session';
+import { assertProjectOwner } from '@/lib/auth';
+import { ApiError } from '@/lib/errors';
+
+export async function GET(
+ request: Request,
+ { params }: { params: { id: string } }
+) {
+ try {
+ const session = await getSession();
+ const project = await db.getProject(params.id);
+
+ if (!project) {
+ return NextResponse.json(
+ { error: 'Project not found' },
+ { status: 404 }
+ );
+ }
+
+ await assertProjectOwner(session.userId, project);
+
+ return NextResponse.json(project);
+ } catch (error) {
+ return ApiError.handle(error);
+ }
+}
+
+export async function PUT(
+ request: Request,
+ { params }: { params: { id: string } }
+) {
+ try {
+ const session = await getSession();
+ const project = await db.getProject(params.id);
+
+ if (!project) {
+ return NextResponse.json(
+ { error: 'Project not found' },
+ { status: 404 }
+ );
+ }
+
+ await assertProjectOwner(session.userId, project);
+
+ const input = await request.json();
+ const updatedProject = await db.updateProject(params.id, input);
+
+ if (!updatedProject) {
+ return NextResponse.json(
+ { error: 'Failed to update project' },
+ { status: 500 }
+ );
+ }
+
+ return NextResponse.json(updatedProject);
+ } catch (error) {
+ return ApiError.handle(error);
+ }
+}
--- /dev/null
+++ b/src/app/api/tasks/route.ts
@@ -0,0 +1,18 @@
+import { NextResponse } from 'next/server';
+import { db } from '@/lib/db';
+import { getSession } from '@/lib/session';
+
+export async function GET() {
+ try {
+ const session = await getSession();
+ const projects = await db.listProjects();
+ const userProjects = projects.filter(project => project.ownerId === session.userId);
+
+ return NextResponse.json(userProjects);
+ } catch (error) {
+ return NextResponse.json(
+ { error: 'Failed to fetch tasks' },
+ { status: 500 }
+ );
+ }
+}
--- /dev/null
+++ b/src/components/TaskList.tsx
@@ -0,0 +1,58 @@
+import { useState, useEffect } from 'react';
+
+type Task = {
+ id: string;
+ title: string;
+ status: 'todo' | 'in-progress' | 'done';
+ projectId: string;
+};
+
+export function TaskList({ projectId }: { projectId: string }) {
+ const [tasks, setTasks] = useState<Task[]>([]);
+ const [loading, setLoading] = useState(true);
+ const [error, setError] = useState<string | null>(null);
+
+ useEffect(() => {
+ async function fetchTasks() {
+ try {
+ const response = await fetch(`/api/tasks?projectId=${projectId}`);
+ if (!response.ok) {
+ throw new Error('Failed to fetch tasks');
+ }
+ const data = await response.json();
+ setTasks(data.tasks);
+ } catch (err) {
+ setError(err instanceof Error ? err.message : 'Unknown error');
+ } finally {
+ setLoading(false);
+ }
+ }
+
+ fetchTasks();
+ }, [projectId]);
+
+ if (loading) {
+ return <div>Loading tasks...</div>;
+ }
+
+ if (error) {
+ return <div>Error: {error}</div>;
+ }
+
+ return (
+ <div className="task-list">
+ {tasks.length === 0 ? (
+ <div>No tasks found</div>
+ ) : (
+ <ul>
+ {tasks.map((task) => (
+ <li key={task.id}>
+ <h3>{task.title}</h3>
+ <span>Status: {task.status}</span>
+ </li>
+ ))}
+ </ul>
+ )}
+ </div>
+ );
+}
--- /dev/null
+++ b/src/lib/auth.ts
@@ -0,0 +1,15 @@
+import { db } from './db';
+import { getSession } from './session';
+
+export async function assertProjectOwner(projectId: string): Promise<void> {
+ const session = await getSession();
+ const project = await db.getProject(projectId);
+
+ if (!project) {
+ throw new Error('Project not found');
+ }
+
+ if (project.ownerId !== session.userId) {
+ throw new Error('Unauthorized access to project');
+ }
+}
--- /dev/null
+++ b/src/lib/errors.ts
@@ -0,0 +1,45 @@
+export class UnauthorizedError extends Error {
+ constructor(message: string = "Unauthorized") {
+ super(message);
+ this.name = "UnauthorizedError";
+ }
+}
+
+export class NotFoundError extends Error {
+ constructor(message: string = "Not found") {
+ super(message);
+ this.name = "NotFoundError";
+ }
+}
+
+export class ValidationError extends Error {
+ constructor(message: string = "Invalid input") {
+ super(message);
+ this.name = "ValidationError";
+ }
+}
+
+export type ApiErrorResponse = {
+ error: {
+ name: string;
+ message: string;
+ };
+};
+
+export function toApiErrorResponse(error: unknown): ApiErrorResponse {
+ if (error instanceof Error) {
+ return {
+ error: {
+ name: error.name,
+ message: error.message,
+ },
+ };
+ }
+
+ return {
+ error: {
+ name: "InternalError",
+ message: "An unexpected error occurred",
+ },
+ };
+}
Run summary
{
"status": "completed",
"exitCode": 0,
"durationMs": 33201,
"adapter": {
"id": "python-openrouter",
"version": "1.0.0",
"label": "Python agent loop (deepseek/deepseek-chat-v3-0324)",
"kind": "harness"
},
"model": {
"provider": "openrouter",
"name": "deepseek/deepseek-chat-v3-0324",
"baseUrl": "https://openrouter.ai/api/v1"
}
}The score is reproducible from the task, ruleset, scoring configuration, and captured repository text. No model call contributed to it.