Skip to content

Short-circuit detail page HEAD probes - #1286

Merged
arpandhakal merged 5 commits into
mainfrom
cursor/OUT-3812-cursor-automated-triage-response-b1cc
Jul 13, 2026
Merged

Short-circuit detail page HEAD probes#1286
arpandhakal merged 5 commits into
mainfrom
cursor/OUT-3812-cursor-automated-triage-response-b1cc

Conversation

@cursor

@cursor cursor Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Added a Next proxy handler for /detail/:task_id/:user_type that returns an empty 200 with Cache-Control: no-store for HEAD requests.
  • Left non-HEAD requests on the normal route path.
  • Added focused Jest coverage for HEAD short-circuiting and GET pass-through behavior.

Testing Criteria

  • yarn test src/proxy.test.ts --runInBand passes.
  • yarn lint:check passes with existing warnings only.
  • yarn tsc --noEmit still fails on the known pre-existing src/icons/index.ts SVG module declaration errors.
  • Runtime check with PORT=3012 yarn dev: curl -i -X HEAD "http://localhost:3012/detail/92149834-0854-483b-bd14-2bed91d1182a/cu?token=test-token" returns HTTP/1.1 200 OK and cache-control: no-store without compiling/rendering /detail/[task_id]/[user_type].
  • Runtime check with GET to the same route shape still renders through the detail route (200, existing invalid-token UI), confirming the proxy is scoped to HEAD.

resolves OUT-3802 OUT-3802: TypeError: fetch failed

Notes

  • Sentry TASKS-8J shows production HEAD requests to /detail/[task_id]/[user_type] reaching TasksService.getTraversalPath, then failing when Prisma cannot reach the Supabase pooler. This PR prevents low-value HEAD probes from invoking detail-page DB work.

Impact & Surface Area of Change

  • Affects only HEAD requests matching /detail/:task_id/:user_type.
  • GET/POST/browser detail flows should remain on the existing route behavior.
Open in Web View Automation 

Co-authored-by: Neil Raina <makeitraina@users.noreply.github.com>
@linear-code

linear-code Bot commented Jun 3, 2026

Copy link
Copy Markdown

OUT-3812

OUT-3802

@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
tasks-app Ready Ready Preview, Comment Jul 13, 2026 7:56am

Request Review

@priosshrsth
priosshrsth marked this pull request as ready for review June 11, 2026 10:07
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Deployment failed with the following error:

Deploying Serverless Functions to multiple regions is restricted to the Pro and Enterprise plans.

Learn More: https://vercel.link/multiple-function-regions

@greptile-apps

greptile-apps Bot commented Jun 11, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a Next.js 16 proxy.ts handler that short-circuits HEAD requests to /detail/:task_id/:user_type with an empty 200 Cache-Control: no-store response, preventing bot probes from triggering Prisma/Supabase DB calls that were surfacing as TypeError: fetch failed in Sentry (TASKS-8J / OUT-3802). All other methods pass through unchanged via NextResponse.next().

  • The file name (src/proxy.ts), export name (proxy), and config.matcher are all correct for Next.js 16.2.6 and the src/-directory project layout.
  • The matcher pattern /detail/:task_id/:user_type precisely targets the two-segment dynamic route, leaving all other paths unaffected.
  • The PR description checks off src/proxy.test.ts as added, but the test file is absent from the diff and from the repository.

Confidence Score: 5/5

Safe to merge — the change is a small, targeted proxy handler that only intercepts HEAD requests on one specific path pattern; GET and all other methods are unaffected.

The implementation is minimal and correct: correct file location for the Next.js 16 src/ layout, correct export name, valid matcher syntax, and a straightforward method check. The only gap is that the test file claimed in the PR description was not committed, but the logic itself is simple enough that this does not introduce risk to the existing detail page flows.

No files require special attention; src/proxy.ts is the sole change and is self-contained.

Important Files Changed

Filename Overview
src/proxy.ts Adds Next.js 16 proxy handler that short-circuits HEAD requests to /detail/:task_id/:user_type with 200 + Cache-Control: no-store, passing all other methods through normally. File name, export, and matcher syntax are all correct for Next.js 16.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Incoming request] --> B{Matches\n/detail/:task_id/:user_type?}
    B -- No --> Z[Normal Next.js routing]
    B -- Yes --> C{request.method\n=== 'HEAD'?}
    C -- Yes --> D["NextResponse(null, 200)\nCache-Control: no-store\n(no DB call, no page render)"]
    C -- No --> E["NextResponse.next()\n(passes to detail page handler)"]
    E --> F[TasksService.getTraversalPath\n→ Prisma → Supabase pooler]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[Incoming request] --> B{Matches\n/detail/:task_id/:user_type?}
    B -- No --> Z[Normal Next.js routing]
    B -- Yes --> C{request.method\n=== 'HEAD'?}
    C -- Yes --> D["NextResponse(null, 200)\nCache-Control: no-store\n(no DB call, no page render)"]
    C -- No --> E["NextResponse.next()\n(passes to detail page handler)"]
    E --> F[TasksService.getTraversalPath\n→ Prisma → Supabase pooler]
Loading

Reviews (3): Last reviewed commit: "remove proxy test" | Re-trigger Greptile

Comment thread src/proxy.ts
Comment thread src/proxy.test.ts Outdated
Comment thread src/proxy.test.ts Outdated
@priosshrsth

Copy link
Copy Markdown
Collaborator

@greptileai re review this pr

@priosshrsth priosshrsth left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Let's try this. I think I checked this pr or another pr with similar changes to load the detail page. It was working for me. But once this is deployed lets test the detail page just in case.

@arpandhakal
arpandhakal merged commit b0f2a5e into main Jul 13, 2026
3 checks passed
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.

3 participants