/** * Paginated backfill of three GitHub REST streams with per-stream * high-water marks (HWMs): * - /repos/{repo}/issues -> issues_hwm * - /repos/{repo}/issues/comments -> issue_comments_hwm * - /repos/{repo}/pulls/comments -> pr_review_comments_hwm * * Crash safety (codex P1 #3): each stream's HWM is persisted ONLY after * the stream fully drains. If stream 2 throws mid-flight, stream 1's HWM * is committed and stream 2's stays NULL (or its prior value). Rerun * picks up from stream 1's saved HWM and re-fetches stream 2 from its * last committed point. * * Codex P1 #2: the /issues endpoint returns BOTH issues and PRs (a PR is * an issue with a `pull_request` field). We skip PRs here so they don't * get ingested under the issues schema. PRs are handled via webhook in * V1 (no /pulls backfill stream — review comments cover the discussion * surface). * * Privacy (V1 limitation): the REST list endpoints don't reliably set * `repository.private`, and resolving it requires an extra API call per * repo. Backfill leaves the field undefined so scopeFromRepository falls * through to private. Callers who know the repo is public can re-tag * downstream; the fail-safe default protects private orgs. */ import type { Context } from '../../api.js'; import type { GitHubFetcher } from './octokit-client.js'; export interface BackfillOpts { /** e.g. 'acme/repo'. */ repoFullName: string; fetcher: GitHubFetcher; token: string; /** Optional cap on items per stream. Useful for tests. */ maxPerStream?: number; /** sleep ms — injectable so tests don't actually wait. */ sleepMs?: (ms: number) => Promise; } export interface BackfillStreamCounts { issues: number; issueComments: number; prReviewComments: number; } export interface BackfillResult { ingested: BackfillStreamCounts; pages: BackfillStreamCounts; } export declare function backfillRepo(ctx: Context, opts: BackfillOpts): Promise; //# sourceMappingURL=backfill.d.ts.map