Skip to content

Give every report a JSON twin at /s/<domain>.json - #58

Merged
maaland merged 1 commit into
mainfrom
feat/json-twin-35
Oct 7, 2026
Merged

maaland merged 1 commit into
mainfrom
feat/json-twin-35

Conversation

@maaland

@maaland maaland commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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… } }
    • Same fields as the MCP get_scan tool (scanId, domain, status, report), plus the scan's URL, times and the report page, so agents see one shape everywhere.
    • Running: status: "running", report: null.
    • Unknown domain: 404 with { error: "not_scanned", domain, message, page }. Scanning by API comes with HTTP scan API #37.
    • Headers: Access-Control-Allow-Origin: * (reading is free). Cache is max-age=60, s-maxage=300 when finished and s-maxage=2 while running.
    • The domain is lower-cased, as on the page.
  • Routing: domains have dots, so /s/<domain>.json can't be its own [domain] segment. next.config.ts rewrites it to the route handler /api/reports/[domain], which HTTP scan API #37 can build on.
  • Report page: a mono <domain>.json link 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, and report on 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

  • Unit tests for done (a real report from the replayed drippa.ai recording, parsed with the zod schema that core keeps equal to the committed JSON Schema), running and unknown.
  • Production build against a throwaway database: curl of 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 build pass.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
stackprobe Ready Ready Preview Oct 7, 2026 6:19pm UTC

Request Review

@drippa-ai

drippa-ai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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
Not tested in the browser: the test user could not sign in: could not get past Vercel’s protection — check the bypass secret

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.
Browser check could not run: the test user could not sign in: could not get past Vercel’s protection — check the bypass secret

Before you start

  • At least one domain, for example drippa.ai, has a finished scan on the preview
  • You know a domain that has never been scanned on the preview, for example new-example.test
  1. JSON twin for every report: /s/<domain>.json #35 Open the report page for a domain that has already been scanned.
    → Next to Copy link, a link reads the domain name followed by .json.
  2. JSON twin for every report: /s/<domain>.json #35 Click the domain .json link.
    → The browser shows data with the scan id, domain, status done, start and finish times, the report page address, and the full report.
  3. JSON twin for every report: /s/<domain>.json #35 Open the same .json address with the domain typed in capital letters.
    → The same report data comes back, with the domain in lower case.
  4. JSON twin for every report: /s/<domain>.json #35 Open the .json address for a domain that has never been scanned.
    → A not-found answer says the domain hasn't been scanned yet, tells you to open the page to scan it, and gives the page address.
  5. JSON twin for every report: /s/<domain>.json #35 On a report page, click Scan again, then open the .json address right away while the scan is still running.
    → The data shows status running and an empty report. Once the scan finishes and you reload, the report appears.
  6. Go back to the report page and check that it still shows the report, Copy link and Scan again, on a narrow phone-width window too.
    → The page looks as before, and on a phone the .json link sits on its own row.
Details

Each 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: 2 tickets (#35 claimed, #37 cited), 8 of 8 changed files read, plus the store lookup elsewhere in the repo

  • 🎫 drippa-ai/stackprobe#35 ✅ Aligned — The change adds the data address, the running and not-found answers, public reading with cache rules, the page link, and the tests the ticket asks for.
  • 🎫 drippa-ai/stackprobe#37 — referenced, not reviewed

Updated by Drippa • 2026-10-07 18:32 UTC

Comment @drippa-ai review for a fresh review.

maaland added a commit that referenced this pull request Oct 7, 2026
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>
@maaland
maaland merged commit 2cc9035 into main Oct 7, 2026
7 of 9 checks passed
@maaland
maaland deleted the feat/json-twin-35 branch October 7, 2026 18:24

This branch was successfully deployed

1 active deployment
Preview — 20e95917 Deployed Oct 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON twin for every report: /s/<domain>.json

1 participant