Skip to content

fix(registry): serve tag profiles stale-while-revalidate - #190

Merged
harlan-zw merged 2 commits into
mainfrom
fix/issue-185
Sep 14, 2026
Merged

harlan-zw merged 2 commits into
mainfrom
fix/issue-185

Conversation

@harlan-github-agent

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Closes #185

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

The sentry-checkin routine flagged that /api/tags/[slug] recomputes on every crawler sweep. The handler cached for only 60 seconds with stale-while-revalidate disabled, and the backing query is a heavy FTS scan plus per-row subqueries, so a sweep across many tags re-ran it for every page every minute. That matches the pattern behind SKILLD-19, SKILLD-1C, and SKILLD-1H.

The profile now stays fresh for an hour and keeps serving stale for a day while a background refresh runs, the same shape the skill-live endpoint already uses. A stale entry also survives a failed refresh, so a tag whose data briefly empties out keeps rendering its last good profile instead of erroring mid-sweep.

One thing to check: fetchedAt in the payload now shows when the cached profile was computed and can lag up to a day. Nothing in the UI or sitemap seems to read it, but worth a look.

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Sep 8, 2026
@harlan-github-agent

harlan-github-agent Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-09-14 06:53 UTC.

GitHub merged this pull request.

No material findings were recorded.

17de384c-fcc2-4cad-9221-b58b6eb3a982

@harlan-github-agent harlan-github-agent Bot added harlan-agent-blocked The automated Review found a material defect in this head commit. harlan-agent-running An Agent holds a Task on this issue or pull request right now. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. harlan-agent-blocked The automated Review found a material defect in this head commit. labels Sep 8, 2026
@harlan-github-agent harlan-github-agent Bot added harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-pending The automated Review is waiting on a gate for this head commit. harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-running An Agent holds a Task on this issue or pull request right now. harlan-agent-pending The automated Review is waiting on a gate for this head commit. labels Sep 8, 2026
@harlan-zw
harlan-zw merged commit 8a28fa3 into main Sep 14, 2026
5 checks passed
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-ready The automated Review passed every gate on this head commit. label Sep 14, 2026
harlan-zw added a commit that referenced this pull request Sep 14, 2026
* perf(registry): cut skilld-db rows read on repo skill counts

skilld-db reads grew from 104M to about 1B rows a day, pushing the
account past the 25B/month D1 free tier. The hot statements computed a
correlated repo Skill count per row before any LIMIT, reading sum(c^2)
rows, and re-ran on one to five minute caches.

repos.repo_skill_count is not used: sync stores the SKILL.md file count
and never updates it when source_resolved clears, and it disagrees with
the live count for 7,159 of 8,618 repos.

Claude-Session: https://claude.ai/code/session_014N85FDJLggfBs3BHJXT7GZ

* refactor(registry): leave handler cache lengths to open swr PRs

PRs #189 and #190 already change the tag and cluster handler cache
options, so this branch keeps only the query changes there.

Claude-Session: https://claude.ai/code/session_014N85FDJLggfBs3BHJXT7GZ

---------

Co-authored-by: Harlan GitHub Agent <harlan-github-agent[bot]@users.noreply.github.com>
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.

Tag profile cache expires after 60s with no stale serving

1 participant