feat(selfhost): scheduled + on-demand refresh for repo-doc generation - #3202
Conversation
Adds a daily fan-out sweep (queued behind each repo's own repoDocGeneration.refreshIntervalDays, default weekly) plus a manual MCP trigger, both routed through one shared runner so eligibility and diff-aware no-change short-circuiting can never diverge between the two paths. Last-attempt tracking reuses the existing signal-snapshot table instead of a new migration. Closes #3003. Part of #2993.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-04 20:23:18 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3202 +/- ##
=======================================
Coverage 94.73% 94.74%
=======================================
Files 270 272 +2
Lines 29718 29768 +50
Branches 10838 10850 +12
=======================================
+ Hits 28154 28204 +50
Misses 918 918
Partials 646 646
🚀 New features to boost your workflow:
|
The new hour===9 branch in enqueueScheduledJobs had no scheduled-worker test exercising either side, dropping patch coverage below the gate.
…p fan-out (#3219) fanOutRepoDocRefreshSweepJobs called getLastRepoDocRefreshAttemptedAt once per installed repo, an N+1 query pattern flagged in review on PR #3202 after it merged (the finding was advisory and did not block the owner-PR auto-merge, so it landed as follow-up work). Adds listLatestSignalSnapshotsForTargets, a bulk latest-per-target-key query, and a getLastRepoDocRefreshAttemptedAtBulk wrapper so the daily sweep does one round trip across every candidate repo instead of scaling linearly with the installed-repo count.
Summary
Closes out the #2993 repo-doc generation roadmap by adding a scheduled refresh sweep and an on-demand manual trigger, both routed through one shared runner so eligibility and diffing can never diverge between the two paths.
repo-doc-refresh-sweep, enqueued at hour 9 UTC alongside the other self-host cron jobs) fans out to every repo withrepoDocGeneration.enabled, but only enqueues a per-repo refresh if that repo's ownrepoDocGeneration.refreshIntervalDays(default 7 / weekly, operator-configurable per repo via.gittensory.yml) has actually elapsed since the last attempt.gittensory_refresh_repo_docs, lets a maintainer force an immediate refresh for one repo without waiting for the interval, using the samerequireRepoManageAccessgate as other repo-management MCP tools.src/github/repo-doc-refresh-runner.ts): both paths callperformRepoDocRefresh, which resolves the repo's action mode the same way the executor does, delegates to the existingopenRepoDocPullRequest(unchanged -- it already owns enable/scope/eligibility/diffing/delivery), and records a "last attempted" marker afterward regardless of outcome. A manual trigger resets the scheduled clock too, so the sweep doesn't immediately re-check a repo an operator just refreshed by hand.repo-doc-refresh-attemptsignal type) instead of a migration, matching feat(config): add .gittensory.yml surface to enable/scope repo-doc generation #3002's own manifest-only precedent for this feature area.openRepoDocPullRequest-- there is no separate eligibility code path for the scheduled vs. manual trigger.Closes #3003. Part of #2993.
Scope
site/,CNAME, or**/lovable/**Validation
npm run typechecknpx vitest run test/unit/repo-doc-refresh-schedule.test.ts test/unit/repo-doc-refresh-runner.test.ts test/unit/repo-doc-refresh-sweep.test.ts test/unit/mcp-refresh-repo-docs.test.ts test/unit/focus-manifest.test.ts test/unit/gittensory-focus-manifest.test.ts test/unit/repo-doc-pr.test.ts test/unit/no-direct-octokit.test.ts-- 325/325 passingnpm run test:changed(diff-aware full sweep againstorigin/main, incl.test/unit/queue.test.ts) -- 5736/5743 passing (7 pre-existing skips, 0 failures)coverage/lcov.infoBRDA parsing (both the new dedicated test files and the new conditionals added to the large sharedsrc/queue/processors.tsandsrc/mcp/server.ts)Safety
requireRepoManageAccess, matching the access-control pattern of other repo-management tools; static "mcp" identity still respectsMCP_ACTUATION_REPO_ALLOWLIST