Repository navigation
Give every report a JSON twin at /s/<domain>.json - #58
Conversation
The domain's newest scan as data: the same fields the MCP get_scan tool returns (scanId, domain, status, report) plus url, createdAt, finishedAt and the report page's address. The report itself matches schema/report.v1.json; it's null while the scan runs. An unknown domain gets a 404 saying where to scan it. Readable from anywhere (CORS *), cached for minutes once finished and seconds while running. The report page links to it, visibly and with a rel=alternate link for agents. Closes #35 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Product review: Give every report a JSON twin at /s/.json✅ Delivers ticket #35 — 5 of 5 outcomes What was promised
Not in this change: Starting and polling scans through the key-protected scan API (#37), which this pull request leaves for later. Proof Tests worked out by Drippa from ticket #35, the pull request description and the code change — none written by hand. Test it yourself (6 steps)Page and behaviour change — click through it on the preview. Before you start
DetailsEach report now has a data version at the report page's address with .json added. Anyone can read it without a key. A finished scan returns the scan's details with the report inside, a running scan returns its status with no report yet, and a domain that was never scanned returns a not-found answer that points to the page where a scan can start. The report page shows a visible link to this data version and also announces it in the page header for agents. Test coverage: ✅ Well covered — New tests cover a finished scan checked against the report format, a running scan and an unknown domain, and the page test checks the new link. 🔍 Checked:
Updated by Drippa • 2026-10-07 18:32 UTC Comment |
Closes #59 Covers both "Done when" lines of #59. `packages/store-postgres/src/store.test.ts` creates a fresh PGlite per test. The first one also compiles PGlite's WebAssembly, which sometimes took longer than the first test's 5 s (seen on #58, on both Node versions). A `beforeAll` with a 60 s limit now starts and closes one PGlite before the tests, so the compile is cached and no test pays for it. The tests themselves are unchanged. Checked: full `pnpm test` three times in a row locally, 341 passing each time; `pnpm lint` passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Closes #35
Covers all three "Done when" lines of #35: the report validates against
schema/report.v1.json(tested with a replayed fixture scan), the 404 and running cases are tested, and the report page links to the twin.What changes
GET /s/<domain>.json: the domain's newest scan:{ "scanId": "…", "domain": "drippa.ai", "url": "https://drippa.ai/", "status": "done", "createdAt": "…", "finishedAt": "…", "page": "https://stackprobe.tech/s/drippa.ai", "report": { …schema/report.v1.json… } }get_scantool (scanId,domain,status,report), plus the scan's URL, times and the report page, so agents see one shape everywhere.status: "running",report: null.404with{ error: "not_scanned", domain, message, page }. Scanning by API comes with HTTP scan API #37.Access-Control-Allow-Origin: *(reading is free). Cache ismax-age=60, s-maxage=300when finished ands-maxage=2while running./s/<domain>.jsoncan't be its own[domain]segment.next.config.tsrewrites it to the route handler/api/reports/[domain], which HTTP scan API #37 can build on.<domain>.jsonlink next to Copy link (its own row on phones), and<link rel="alternate" type="application/json">in the head on every/s/<domain>page.Decision to check
The issue says "the same shape as
schema/report.v1.json, plus scan id, status and timestamps". The schema forbids extra top-level fields, so the scan fields wrap the report rather than sit beside it, andreporton its own validates. If you'd rather have the report at the top level and the scan fields in headers, that's a small change.Checked
curlof done, running, unknown and upper-case domains gives the bodies, status codes and headers above. The page HTML has the alternate link and the visible link. Screenshots at 1280 px and 390 px place it as on the canvas.pnpm lint,pnpm typecheck,pnpm test(344 passing),pnpm buildpass.🤖 Generated with Claude Code