-
Notifications
You must be signed in to change notification settings - Fork 22
test(docs): add comprehensive tests and monitoring for llms.txt endpoints #4676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
e986247
efbfae1
a8466e7
043ea04
413d83c
dc7dd6d
a423f9c
9278b68
9d1d53e
39da4a4
66bf31f
5192121
07ec50a
d9e655a
423abe0
926ee56
d9c164b
30038f4
0bda778
a6f9a0b
40088f4
4466868
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||
| name: Monitor LLM-friendly Docs Endpoints | ||||||
|
|
||||||
| on: | ||||||
| schedule: | ||||||
| # Run every 5 minutes | ||||||
| - cron: '*/5 * * * *' | ||||||
| workflow_dispatch: # Allow manual triggering | ||||||
| push: | ||||||
| branches: | ||||||
| - devin/1762144039-add-llms-txt-tests-monitoring | ||||||
|
||||||
| - devin/1762144039-add-llms-txt-tests-monitoring | |
| - app |
The workflow is configured to trigger only on a development branch, which will prevent the monitoring from running on the main branch or production deployment.
View Details
Analysis
GitHub Actions workflow references non-existent branch preventing manual testing
What fails: The monitoring workflow .github/workflows/monitor-llms-md-endpoints.yml has a push trigger configured for branch devin/1762144039-add-llms-txt-tests-monitoring which no longer exists
How to reproduce:
# Check current branches - devin branch is missing
git branch -a
# Try to trigger workflow on push to current branch (bright-wolf) - won't trigger
git add . && git commit -m "test workflow" && git pushResult: Push trigger never executes because the target branch devin/1762144039-add-llms-txt-tests-monitoring doesn't exist. Git history shows this was a development branch that was merged.
Expected: Push trigger should work on the main production branch (app) to allow testing workflow changes, consistent with other production workflows in the repository like deploy-fai-dev.yml and ci-platform.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will remove the 'branches' section entirely before merging, but for now we want to keep it for testing.
vercel[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { NextRequest } from "next/server"; | ||
| import { describe, expect, it, vi } from "vitest"; | ||
|
|
||
| describe("markdown route slug handling", () => { | ||
| const createMockRequest = (pathname: string, searchParams: Record<string, string> = {}) => { | ||
| const url = new URL(`https://example.com${pathname}`); | ||
| Object.entries(searchParams).forEach(([key, value]) => { | ||
| url.searchParams.set(key, value); | ||
| }); | ||
| return new NextRequest(url); | ||
| }; | ||
|
|
||
| it("should prefer slug from search params over pathname", () => { | ||
| const request = createMockRequest("/api/fern-docs/markdown", { slug: "docs/quickstart" }); | ||
|
|
||
| const slugParam = request.nextUrl.searchParams.get("slug"); | ||
| const slug = slugParam ?? request.nextUrl.pathname.replace(/\.(md|mdx)$/, ""); | ||
vercel[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| expect(slug).toBe("docs/quickstart"); | ||
| }); | ||
|
|
||
| it("should fallback to pathname parsing when slug param is not present", () => { | ||
| const request = createMockRequest("/docs/quickstart.md"); | ||
|
|
||
| const slugParam = request.nextUrl.searchParams.get("slug"); | ||
| const slug = slugParam ?? request.nextUrl.pathname.replace(/\.(md|mdx)$/, ""); | ||
|
|
||
| expect(slug).toBe("/docs/quickstart"); | ||
| }); | ||
|
|
||
| it("should handle .mdx extension in pathname fallback", () => { | ||
| const request = createMockRequest("/docs/quickstart.mdx"); | ||
|
|
||
| const slugParam = request.nextUrl.searchParams.get("slug"); | ||
| const slug = slugParam ?? request.nextUrl.pathname.replace(/\.(md|mdx)$/, ""); | ||
|
|
||
| expect(slug).toBe("/docs/quickstart"); | ||
| }); | ||
|
|
||
| it("should handle nested paths in slug param", () => { | ||
| const request = createMockRequest("/api/fern-docs/markdown", { | ||
| slug: "learn/sdks/overview/quickstart" | ||
| }); | ||
|
|
||
| const slugParam = request.nextUrl.searchParams.get("slug"); | ||
| const slug = slugParam ?? request.nextUrl.pathname.replace(/\.(md|mdx)$/, ""); | ||
|
|
||
| expect(slug).toBe("learn/sdks/overview/quickstart"); | ||
| }); | ||
|
|
||
| it("should handle empty slug param", () => { | ||
| const request = createMockRequest("/api/fern-docs/markdown", { slug: "" }); | ||
|
|
||
| const slugParam = request.nextUrl.searchParams.get("slug"); | ||
| const slug = slugParam ?? request.nextUrl.pathname.replace(/\.(md|mdx)$/, ""); | ||
|
|
||
| expect(slug).toBe(""); | ||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.