Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"typecheck": "tsc --noEmit",
"security": "pnpm audit && audit-ci",
"lint": "oxlint --no-error-on-unmatched-pattern",
"lint:fix": "oxlint --no-error-on-unmatched-pattern --fix",
"fmt": "oxfmt --check",
"fmt:fix": "oxfmt --write",
"lint:fix": "oxlint --fix --no-error-on-unmatched-pattern",
"fmt": "oxfmt --check --no-error-on-unmatched-pattern",
"fmt:fix": "oxfmt --write --no-error-on-unmatched-pattern",
"test": "pnpm --filter *app --color=always test",
"test:e2e": "pnpm --filter *app --color=always test:e2e",
"test:e2e:component": "pnpm --filter *app --color=always test:e2e:component",
Expand Down
14 changes: 14 additions & 0 deletions packages/app/src/app/api/v1/feedback/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { utf8ToBytes } from '@noble/ciphers/utils.js';
import { getWriteDb } from '@semianalysisai/inferencex-db/connection';
import { type Cipher, createCipher, loadKey } from '@semianalysisai/inferencex-db/lib/encryption';

import { trackServer } from '@/lib/analytics-server';
import { parseFeedbackBody } from './parse';

const aadFor = (column: string) => utf8ToBytes(`user_feedback:${column}`);
Expand Down Expand Up @@ -55,13 +56,20 @@ export async function POST(request: Request) {
return new NextResponse(null, { status: 204 });
}

const pagePath = body.pagePath ?? null;
let cipher: Cipher;
let sql: ReturnType<typeof getWriteDb>;
try {
cipher = createCipher(loadKey('FEEDBACK_SECRET'));
sql = getWriteDb();
} catch (error) {
console.error('feedback: misconfigured', error);
trackServer('feedback_submission_failed', {
error_code: 'E_CRYPTO',
error_name: error instanceof Error ? error.name : 'Unknown',
error_message: (error instanceof Error ? error.message : String(error)).slice(0, 500),
page_path: pagePath,
});
return serverError('E_CRYPTO');
}

Expand Down Expand Up @@ -94,6 +102,12 @@ export async function POST(request: Request) {
`;
} catch (error) {
console.error('feedback: insert failed', error);
trackServer('feedback_submission_failed', {
error_code: 'E_INSERT',
error_name: error instanceof Error ? error.name : 'Unknown',
error_message: (error instanceof Error ? error.message : String(error)).slice(0, 500),
page_path: pagePath,
});
return serverError('E_INSERT');
}

Expand Down
13 changes: 3 additions & 10 deletions packages/app/src/app/compare-per-dollar/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
compareModelDisplayLabel,
parseCompareSlug,
} from '@/lib/compare-slug';
import { getAllComparableCompareSlugs } from '@/lib/compare-availability';
import { getGpuSpecs } from '@/lib/constants';
import {
buildBreadcrumbJsonLd,
Expand All @@ -36,14 +35,6 @@ interface Props {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}

export async function generateStaticParams() {
// Mirror the /compare route's static params — only (model, pair) combos with
// benchmark data on both sides. Direct URL hits to non-enumerated combos
// still render via the dynamic SSR path (with the empty-state fallback).
const slugs = await getAllComparableCompareSlugs();
return slugs.map(({ modelSlug, a, b }) => ({ slug: canonicalCompareSlug(modelSlug, a, b) }));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { slug } = await params;
const parsed = parseCompareSlug(slug);
Expand Down Expand Up @@ -84,7 +75,9 @@ export default async function ComparePerDollarPage({ params, searchParams }: Pro
// alias model resolution, GPU alphabetical order — but redirect target lives
// under /compare-per-dollar/. Query string is preserved across the hop.
const canonical = canonicalCompareSlug(parsed.model.slug, parsed.a, parsed.b);
if (canonical !== slug) {
// canonical is always lowercase; compare against lowercased input so mixed-case
// URLs don't emit a fresh 308 + CDN cache entry every hit.
if (canonical !== slug.toLowerCase()) {
const qs = Object.entries(sp)
.flatMap(([k, v]) => {
if (Array.isArray(v)) return v.map((vv) => [k, vv] as const);
Expand Down
Loading
Loading