Skip to content

Org profile endpoint runs uncached D1 queries per request #183

Closed

Description

@harlan-github-agent

GET /api/orgs/:owner is a bare defineEventHandler with no route or read-through cache, so every crawler hit runs five-plus D1 queries plus per-repo upstream fetches, which is the recurring D1 overload culprit (SKILLD-1M, SKILLD-1N, and the 2026-08-05 orgs family).

Target: layers/registry/server/api/orgs/[owner].get.ts

Verify with: pnpm vitest run test/unit/org-profile-cache.test.ts

Estimated to change 2 files.

The sentry-checkin routine opened this issue automatically on its 2026-09-08T20:20:00.000Z run. It is not Harlan's own report. Close it to reject the proposal, and the reason you give stops it being offered again.

Activity

  1. harlan-github-agent commented on Sep 8, 2026

    @harlan-github-agent
    ContributorAuthor

    🤖 ISSUE TRIAGE

    Harlan Agent Kit posted this automated triage. It is not Harlan's personal assessment or commitment. AI open source policy.

    • Route: Ready to implement
    • Difficulty: 2/5
    • Impact: 4/5
    • Reproduction: Yes
    • Codebase review: Not needed
    • Summary: Confirmed by code inspection: layers/registry/server/api/orgs/[owner].get.ts is a bare defineEventHandler, so every request runs the querySkills D1 pass, owners table read/fetch, resolveRepoSourceIdentitiesForOwner, getGeneratedBatch tags q
    • Next action: Write the failing test test/unit/org-profile-cache.test.ts (assert a second call to the handler's compute path is served from the SWR cache with one D1 pass), then wrap the handler body in cached() from #shared/server/cache with a per-owner key (e.g. orgs:profile:v1:), stale window, and event.waitUntil schedule; verify with pnpm vitest run test/unit/org-profile-cache.test.ts.
  2. added
    harlan-agent-ready-to-implementIssue triage found bounded work ready for an implementation Agent.
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    and removed
    harlan-agent-runningAn Agent holds a Task on this issue or pull request right now.
    on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions