res_bb227a97d7524f17ad8f95abfa8e20efSamplecompleted
Linkstash: authenticated bookmark API
Fake fixture (linkstash/compliant) · no model (fake baseline) · 24 ms · 15 Nov 2026, 15:38
Overall
99.3/ 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%
- 95.0
Tally
12 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 →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
- 4f358c109e68…
Requirement outcomes
Static checks · 12 declared · no produced code executed
The bookmark API route must exist at the specified path.
- Rule
- file_exists · src/app/api/bookmarks/route.ts
- Outcome
- The declared check matched the produced repository.
Produced-code diff
4 added · 1 changed · 0 removed · 116 + / 1 − · 3.2 KiB
unified diff
--- a/package.json
+++ b/package.json
@@ -1,10 +1,10 @@
{
+ "name": "linkstash-compliant",
- "name": "linkstash",
"private": true,
"dependencies": {
"next": "^16.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zod": "^4.1.12"
}
}
--- /dev/null
+++ b/src/app/api/bookmarks/route.ts
@@ -0,0 +1,56 @@
+import { NextResponse } from "next/server";
+
+import { requireUser } from "../../../lib/auth";
+import { db } from "../../../lib/db";
+import { bookmarkSchema } from "../../../lib/schema";
+
+function errorResponse(error: unknown) {
+ const status = error instanceof Error && error.message === "Unauthorized" ? 401 : 500;
+
+ return NextResponse.json(
+ {
+ error: {
+ code: status === 401 ? "UNAUTHORIZED" : "BOOKMARK_REQUEST_FAILED",
+ message: status === 401 ? "Sign in required." : "Unable to process the request.",
+ },
+ },
+ { status },
+ );
+}
+
+export async function GET() {
+ try {
+ const user = await requireUser();
+ const bookmarks = await db.listBookmarks(user.id);
+
+ return NextResponse.json({ bookmarks });
+ } catch (error) {
+ return errorResponse(error);
+ }
+}
+
+export async function POST(request: Request) {
+ try {
+ const user = await requireUser();
+ const body = await request.json();
+ const parsed = bookmarkSchema.safeParse(body);
+
+ if (!parsed.success) {
+ return NextResponse.json(
+ {
+ error: {
+ code: "INVALID_BOOKMARK",
+ message: "Provide a valid URL and title.",
+ },
+ },
+ { status: 400 },
+ );
+ }
+
+ const bookmark = await db.createBookmark(user.id, parsed.data);
+
+ return NextResponse.json({ bookmark }, { status: 201 });
+ } catch (error) {
+ return errorResponse(error);
+ }
+}
--- /dev/null
+++ b/src/components/BookmarkList.tsx
@@ -0,0 +1,43 @@
+"use client";
+
+import { useEffect, useState } from "react";
+
+type Bookmark = {
+ id: string;
+ url: string;
+ title: string;
+};
+
+export function BookmarkList() {
+ const [bookmarks, setBookmarks] = useState<Bookmark[]>([]);
+
+ useEffect(() => {
+ let active = true;
+
+ void fetch("/api/bookmarks")
+ .then((response) => response.json())
+ .then((data: { bookmarks?: Bookmark[] }) => {
+ if (active) {
+ setBookmarks(data.bookmarks ?? []);
+ }
+ });
+
+ return () => {
+ active = false;
+ };
+ }, []);
+
+ if (bookmarks.length === 0) {
+ return <p>No bookmarks yet.</p>;
+ }
+
+ return (
+ <ul>
+ {bookmarks.map((bookmark) => (
+ <li key={bookmark.id}>
+ <a href={bookmark.url}>{bookmark.title}</a>
+ </li>
+ ))}
+ </ul>
+ );
+}
--- /dev/null
+++ b/src/lib/auth.ts
@@ -0,0 +1,8 @@
+export type User = {
+ id: string;
+};
+
+export async function requireUser(): Promise<User> {
+ // Synthetic fixture: a real deployment would verify a session cookie.
+ return { id: "user-synthetic-001" };
+}
--- /dev/null
+++ b/src/lib/schema.ts
@@ -0,0 +1,8 @@
+import { z } from "zod";
+
+export const bookmarkSchema = z.object({
+ url: z.string().url().max(2048),
+ title: z.string().min(1).max(200),
+});
+
+export type BookmarkInput = z.infer<typeof bookmarkSchema>;
Run summary
run record
{
"status": "completed",
"exitCode": 0,
"durationMs": 24,
"adapter": {
"id": "fake",
"version": "1.0.0",
"label": "Fake fixture (linkstash/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.