Public: anyone can read this; the crew can change it.
Dead code in src/core: delete eleven exports nothing calls, and prune the allow list (#16269) #16503
Check · Review · Land · Live — The access wall holds it for a person to decide: a trusted source's pull touches a path a trusted source's work may not change alone. Allow it (merge) or send it back.
Green for 3 days, not landed: it waits for a person: the access wall holds it for a person to decide: a trusted source's pull touches a path a trusted source's work may not change alone. Allow it (merge) or send it back. To unblock: a person who writes the repository merges it or requests changes.
grokbot/forge:fix/16269-dead-exports-core → main 104 commits fork
Combined with main
The preview is built from combined/16503 (f2855a8915): main merged into this pull's head. Merging lands that branch.
The checks line says which commit the check ran on.
scripts/unused-exports-allow.json −13
| @@ -26,39 +26,26 @@ | ||
| 26 | 26 | "src/core/accounts.ts edgeOnlyAccounts", |
| 27 | 27 | "src/core/capacity.ts provideCpusForTest", |
| 28 | 28 | "src/core/credit.ts clearCreditCache", |
| 29 | "src/core/device_grants.ts appIdOfSlug", | |
| 30 | 29 | "src/core/device_grants.ts grantedSlugs", |
| 31 | 30 | "src/core/feed_chips.ts noChips", |
| 32 | "src/core/fence.ts heldIn", | |
| 33 | "src/core/idempotency.ts clearInFlight", | |
| 34 | 31 | "src/core/idempotency.ts resetPruneClock", |
| 35 | "src/core/issue_teams.ts teamsAnswered", | |
| 36 | 32 | "src/core/issues.ts countIssues", |
| 37 | 33 | "src/core/issues.ts issueRefKey", |
| 38 | 34 | "src/core/issues.ts searchIssuesVisibleTo", |
| 39 | 35 | "src/core/ledger_git.ts resetBatchClock", |
| 40 | "src/core/looks.ts isLookKind", | |
| 41 | "src/core/meter.ts PLACEMENTS", | |
| 42 | 36 | "src/core/oidc.ts rotateKeys", |
| 43 | 37 | "src/core/oidc.ts verifyIdToken", |
| 44 | 38 | "src/core/parent_releases.ts refreshIdle", |
| 45 | 39 | "src/core/pulls.ts mergeReadingsSettled", |
| 46 | 40 | "src/core/pulls.ts mergedPullClosingScan", |
| 47 | "src/core/pulls.ts pullsForIssues", | |
| 48 | 41 | "src/core/roles.ts rolesTable", |
| 49 | 42 | "src/core/route_timing.ts readTiming", |
| 50 | "src/core/sealed.ts sealedById", | |
| 51 | 43 | "src/core/search.ts grepCount", |
| 52 | 44 | "src/core/search.ts grepRepo", |
| 53 | 45 | "src/core/sessions.ts sessionUser", |
| 54 | 46 | "src/core/signin-window.ts signinKeyCount", |
| 55 | "src/core/starts.ts startOfAccount", | |
| 56 | "src/core/subscriptions.ts listAllGrants", | |
| 57 | 47 | "src/core/team-metrics.ts keptFigures", |
| 58 | "src/core/timers.ts pendingTimers", | |
| 59 | 48 | "src/core/transfer.ts transfersOf", |
| 60 | "src/core/usage.ts USAGE_BY", | |
| 61 | "src/core/usage.ts USAGE_OUTCOMES", | |
| 62 | 49 | "src/core/v1_proof.ts useProof", |
| 63 | 50 | "src/core/webhooks.ts deliveryBusy", |
| 64 | 51 | "src/flow/stuck_pile.ts forgetStuckRepos", |
src/core/device_grants.ts −3
| @@ -58,6 +58,3 @@ export const grantedSlugs = (db: Database, deviceId: number): string[] => | ||
| 58 | 58 | |
| 59 | 59 | export const allAppSlugs = (db: Database): string[] => |
| 60 | 60 | db.query<{ slug: string }, []>("SELECT slug FROM app ORDER BY slug").all().map((r) => r.slug); |
| 61 | ||
| 62 | export const appIdOfSlug = (db: Database, slug: string): string | undefined => | |
| 63 | db.query<{ id: string }, [string]>("SELECT id FROM app WHERE slug = ?1").get(slug)?.id; |
src/core/idempotency.ts
src/core/issue_teams.ts −4
| @@ -94,10 +94,6 @@ export function teamVerdicts( | ||
| 94 | 94 | }); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | /** Whether every named team has a current verdict on the head (vacuously true with no teams). */ | |
| 98 | export const teamsAnswered = (verdicts: readonly TeamVerdict[]): boolean => | |
| 99 | verdicts.every((v) => v.state !== undefined && !v.stale); | |
| 100 | ||
| 101 | 97 | /** |
| 102 | 98 | * The named teams that still hold the pull: each has a crew reviewer on the |
| 103 | 99 | * pull's repository and no current approval on its head. A stale approval, |
src/core/looks.ts −2
| @@ -11,8 +11,6 @@ import { id as newId } from "../kernel/id.ts"; | ||
| 11 | 11 | /** The three widths a page is pictured at. */ |
| 12 | 12 | export type LookKind = "phone" | "narrow" | "desktop" | "thumb"; |
| 13 | 13 | export const LOOK_KINDS: readonly LookKind[] = ["phone", "narrow", "desktop", "thumb"]; |
| 14 | export const isLookKind = (value: string): value is LookKind => | |
| 15 | (LOOK_KINDS as readonly string[]).includes(value); | |
| 16 | 14 | |
| 17 | 15 | /** |
| 18 | 16 | * The three sizes a picture is kept at, as a person holds them: a phone, a |
src/core/meter.ts −1
| @@ -27,7 +27,6 @@ import { defect } from "../kernel/error.ts"; | ||
| 27 | 27 | |
| 28 | 28 | /** Where an environment ran: hardware the operator owns, or a cloud's. */ |
| 29 | 29 | export type Placement = "owned" | "cloud"; |
| 30 | export const PLACEMENTS: readonly Placement[] = ["owned", "cloud"]; | |
| 31 | 30 | |
| 32 | 31 | /** How long one storage sample stands for, in milliseconds. */ |
| 33 | 32 | export const SAMPLE_SPAN_MS = 3_600_000; |
src/core/pulls.ts −8
| @@ -749,14 +749,6 @@ export function mergedPullCount( | ||
| 749 | 749 | return row?.n ?? 0; |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | /** The pull rows for a page of issues, keyed by issue id. */ | |
| 753 | export function pullsForIssues( | |
| 754 | db: Database, | |
| 755 | issues: readonly Issue[], | |
| 756 | ): Map<string, Pull> { | |
| 757 | return new Map(joinMany(db, issues).map((pull) => [pull.id, pull])); | |
| 758 | } | |
| 759 | ||
| 760 | 752 | /** |
| 761 | 753 | * Which of these pull numbers have landed. |
| 762 | 754 | * |
src/core/sealed.ts −5
| @@ -85,11 +85,6 @@ export function sealedRowById( | ||
| 85 | 85 | return row ? { sealed: row.sealed === 1, authorId: row.author_id } : undefined; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | /** Whether the issue `issueId` is sealed. */ | |
| 89 | export function sealedById(db: Database, issueId: string): boolean { | |
| 90 | return sealedRowById(db, issueId)?.sealed === true; | |
| 91 | } | |
| 92 | ||
| 93 | 88 | /** Issue `number` in `repoId` as `mayView` reads it. */ |
| 94 | 89 | export function sealedRowByNumber( |
| 95 | 90 | db: Database, |
src/core/subscriptions.ts −15
| @@ -481,21 +481,6 @@ export function listGrants(db: Database, scopeId: string): Grant[] { | ||
| 481 | 481 | })); |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | /** Every grant on this forge, for the page that says where each account goes. */ | |
| 485 | export function listAllGrants(db: Database): Grant[] { | |
| 486 | return db | |
| 487 | .query<{ scope_id: string; agent_id: string; subscription_id: string }, []>( | |
| 488 | `SELECT scope_id, agent_id, subscription_id FROM subscription_grant | |
| 489 | ORDER BY subscription_id, scope_id, agent_id`, | |
| 490 | ) | |
| 491 | .all() | |
| 492 | .map((r) => ({ | |
| 493 | scopeId: r.scope_id, | |
| 494 | agentId: r.agent_id, | |
| 495 | subscriptionId: r.subscription_id, | |
| 496 | })); | |
| 497 | } | |
| 498 | ||
| 499 | 484 | /** |
| 500 | 485 | * The set of accounts one agent (or everyone) may use at a scope, replaced |
| 501 | 486 | * whole. An empty set removes the grant, and the wider one applies again. |
src/core/timers.ts −4
| @@ -252,10 +252,6 @@ export function pendingOnce(db: Database, appId: string): number { | ||
| 252 | 252 | return db.query<{ n: number }, [string]>("SELECT COUNT(*) AS n FROM timer WHERE app_id = ?1 AND kind = 'once' AND name = ''").get(appId)?.n ?? 0; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | export function pendingTimers(db: Database, appId: string, limit = 100): Timer[] { | |
| 256 | return db.query<Row, [string, number]>("SELECT * FROM timer WHERE app_id = ?1 AND kind = 'once' AND name = '' ORDER BY due_at LIMIT ?2").all(appId, limit).map(toTimer); | |
| 257 | } | |
| 258 | ||
| 259 | 255 | export function setPaused(db: Database, id: number, paused: boolean, now: number): void { |
| 260 | 256 | const t = getTimer(db, id); |
| 261 | 257 | if (t === undefined) return; |
src/core/usage.ts −13
| @@ -23,12 +23,6 @@ import type { Database } from "bun:sqlite"; | ||
| 23 | 23 | |
| 24 | 24 | /** How a run ended, as far as spend is concerned. */ |
| 25 | 25 | export type UsageOutcome = "ok" | "failed" | "paused" | "running"; |
| 26 | export const USAGE_OUTCOMES: readonly UsageOutcome[] = [ | |
| 27 | "ok", | |
| 28 | "failed", | |
| 29 | "paused", | |
| 30 | "running", | |
| 31 | ]; | |
| 32 | 26 | |
| 33 | 27 | /** |
| 34 | 28 | * What a run was for: `build` (an issue or a pull's feedback), `plan` (a |
| @@ -156,13 +150,6 @@ export function issueUsage( | ||
| 156 | 150 | |
| 157 | 151 | /** What the ledger can be summed by. Each maps to one fixed column. */ |
| 158 | 152 | export type UsageBy = "subscription" | "repo" | "agent" | "issue" | "kind"; |
| 159 | export const USAGE_BY: readonly UsageBy[] = [ | |
| 160 | "subscription", | |
| 161 | "repo", | |
| 162 | "agent", | |
| 163 | "issue", | |
| 164 | "kind", | |
| 165 | ]; | |
| 166 | 153 | const COLUMN: Readonly<Record<UsageBy, string>> = { |
| 167 | 154 | subscription: "subscription_id", |
| 168 | 155 | repo: "repo_id", |