Skip to content
res_6d753e6a906a48dd88767946d4092b41Samplecompleted

TaskBoard: owner-scoped project API

Fake fixture (taskboard/compliant) · no model (fake baseline) · 1 ms · 18 Nov 2026, 06:08

Compare

Overall

99.5/ 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%
96.7

Tally

9 passed0 failed0 drifted0 unverified

UNVERIFIED earns zero but is counted separately from FAIL.

Unattributed

Failure attribution

No trace was captured for this run.

Inspect the 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
b6a8435d66ca…

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

4 added · 0 changed · 0 removed · 145 + / 0 − · 3.5 KiB

unified diff
--- /dev/null
+++ b/src/app/api/projects/[id]/route.ts
@@ -0,0 +1,64 @@
+import { NextResponse } from "next/server";
+
+import { assertProjectOwner, requireSession } from "../../../../lib/auth";
+import { db } from "../../../../lib/db";
+
+type RouteContext = {
+  params: Promise<{ id: string }>;
+};
+
+function errorResponse(error: unknown) {
+  const status = error instanceof Error && error.message === "Forbidden" ? 403 : 500;
+
+  return NextResponse.json(
+    {
+      error: {
+        code: status === 403 ? "FORBIDDEN" : "PROJECT_REQUEST_FAILED",
+        message:
+          status === 403
+            ? "You do not have access to this project."
+            : "Unable to process the project request.",
+      },
+    },
+    { status },
+  );
+}
+
+export async function GET(_request: Request, context: RouteContext) {
+  try {
+    const session = await requireSession();
+    const { id } = await context.params;
+
+    await assertProjectOwner(session, id);
+
+    const project = await db.getProject(id);
+
+    if (!project) {
+      return NextResponse.json({ error: "Project not found" }, { status: 404 });
+    }
+
+    return NextResponse.json({ project });
+  } catch (error) {
+    return errorResponse(error);
+  }
+}
+
+export async function PUT(request: Request, context: RouteContext) {
+  try {
+    const session = await requireSession();
+    const { id } = await context.params;
+
+    await assertProjectOwner(session, id);
+
+    const body = await request.json();
+    const project = await db.updateProject(id, body);
+
+    if (!project) {
+      return NextResponse.json({ error: "Project not found" }, { status: 404 });
+    }
+
+    return NextResponse.json({ project });
+  } catch (error) {
+    return errorResponse(error);
+  }
+}
--- /dev/null
+++ b/src/app/api/tasks/route.ts
@@ -0,0 +1,16 @@
+import { NextResponse } from "next/server";
+
+import { db } from "../../../lib/db";
+
+export async function GET() {
+  const projects = await db.listProjects();
+  const tasks = projects.flatMap((project) => [
+    {
+      id: `${project.id}-task-1`,
+      projectId: project.id,
+      title: `Review ${project.name}`,
+    },
+  ]);
+
+  return NextResponse.json({ tasks });
+}
--- /dev/null
+++ b/src/components/TaskList.tsx
@@ -0,0 +1,47 @@
+"use client";
+
+import { useEffect, useState } from "react";
+
+import { db } from "../lib/db";
+
+type Task = {
+  id: string;
+  title: string;
+};
+
+export function TaskList() {
+  const [tasks, setTasks] = useState<Task[]>([]);
+
+  useEffect(() => {
+    let active = true;
+
+    void db.listProjects().then((projects) => {
+      if (!active) {
+        return;
+      }
+
+      setTasks(
+        projects.map((project) => ({
+          id: `${project.id}-task-1`,
+          title: `Review ${project.name}`,
+        })),
+      );
+    });
+
+    return () => {
+      active = false;
+    };
+  }, []);
+
+  if (tasks.length === 0) {
+    return <p>No tasks yet.</p>;
+  }
+
+  return (
+    <ul>
+      {tasks.map((task) => (
+        <li key={task.id}>{task.title}</li>
+      ))}
+    </ul>
+  );
+}
--- /dev/null
+++ b/src/lib/auth.ts
@@ -0,0 +1,18 @@
+import { db } from "./db";
+import { getSession } from "./session";
+
+// Synthetic fixture: no real auth.
+export async function requireSession() {
+  return getSession();
+}
+
+export async function assertProjectOwner(
+  session: { userId: string },
+  projectId: string,
+): Promise<void> {
+  const project = await db.getProject(projectId);
+
+  if (!project || project.ownerId !== session.userId) {
+    throw new Error("Forbidden");
+  }
+}

Run summary

run record
{
  "status": "completed",
  "exitCode": 0,
  "durationMs": 1,
  "adapter": {
    "id": "fake",
    "version": "1.0.0",
    "label": "Fake fixture (taskboard/compliant)",
    "kind": "baseline"
  },
  "model": null
}

The score is reproducible from the task, ruleset, scoring configuration, and captured repository text. No model call contributed to it.