Skip to content
Open
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
10 changes: 10 additions & 0 deletions e2e/docs-request-classifier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,16 @@ const cases: ClassificationCase[] = [
surface: 'docs',
},
},
{
name: 'non-mcp api route is not a docs surface',
input: { path: '/api/og', userAgent: 'facebookexternalhit/1.1' },
expected: {
agent_kind: 'human',
match_source: 'none',
shouldTrack: false,
surface: 'other',
},
},
]

for (const item of cases) {
Expand Down
4 changes: 4 additions & 0 deletions src/lib/docs-request-classifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ function classifySurface(path: string): DocsRequestSurface {

if (pathname === '/llms.txt' || pathname === '/llms-full.txt') return 'llms'
if (pathname === '/api/mcp' || pathname.startsWith('/api/mcp/')) return 'mcp'
// Every other /api/* route (og, feedback, faucet, index-supply, ...) is an
// application endpoint, not a docs surface. Without this, isDocsPage() treats
// extensionless paths like /api/og as 'docs' and mislabels their traffic.
if (pathname === '/api' || pathname.startsWith('/api/')) return 'other'
if (pathname === '/skill.md') return 'skill'
if (pathname.startsWith('/.well-known/')) return 'well_known'
if (pathname.endsWith('.md')) return 'markdown'
Expand Down