/** Prune and compact the sha-keyed map store branch through the GitHub * git-data API — never by cloning the branch (#423). * * The map store is a CACHE: bundles are keyed by commit SHA, so once the base * branch moves past a SHA its bundle can never be restored again, and nothing * links into the branch (restore is a depth-1 sparse clone of the tip). That * makes the correct bound a SQUASH, not a tip-only delete: the branch is * rewritten as a single orphan commit holding only the retained bundles, so * both the tip tree and the history are bounded in one operation. This is * deliberately different from the report branch, whose history must survive * because PR comments pin report blobs at commit SHAs. * * Dating bundles: publish stamps each bundle with a commit whose message is * `StyleProof map `, so the branch log dates every * bundle — until the first squash discards that log. The squash therefore * writes a `styleproof-map-store-prune.json` sidecar at the branch root * carrying the retained bundles' dates forward; the next run merges log-derived * dates over sidecar dates. A bundle with neither (a legacy bundle from before * this tool) sorts oldest and is pruned first. * * Concurrency: the ref update must force (an orphan commit is never a * fast-forward), so a publish that lands in the seconds between the tip read * and the ref update is discarded with the old tip. For a cache that loss is * self-healing — the next run misses and recaptures — and accepting it keeps * this tool a single bounded pass instead of a lease protocol. The run logs * the tip it replaced so the loss is observable, never silent. */ export declare const MAP_STORE_PRUNE_SIDECAR = "styleproof-map-store-prune.json"; export type MapBundlePruneSelection = { /** Bundle directory names to keep, newest first. */ retainedDirectoryNames: string[]; /** Bundle directory names to delete. */ prunedDirectoryNames: string[]; }; /** Pure selection policy: drop bundles older than the retention cutoff, then * cap what survives at `maximumBundleCount`, newest first. A bundle with no * known date sorts oldest (epoch zero) — the only undated bundles are legacy * ones from before the sidecar existed, since every publish since the map * store shipped stamps a dated commit. */ export declare function selectMapBundlesToRetain(options: { bundleDirectoryNames: readonly string[]; lastPublishedEpochSecondsByDirectoryName: ReadonlyMap; retentionCutoffEpochSeconds: number; maximumBundleCount: number; }): MapBundlePruneSelection; export type MapStorePruneApiOptions = { apiBaseUrl: string; repository: string; token: string; branch: string; /** Bundles newer than this many days survive retention (default 14). */ retentionDays?: number; /** At most this many bundles survive, newest first (default 40). */ maximumBundleCount?: number; /** Skip the rewrite when nothing is prunable and the branch history holds no * more than this many commits, so a scheduled run does not force-push a * fresh orphan commit every day for nothing (default 30). */ historyCommitLimit?: number; /** Upper bound on commit-log pages read for bundle dates (default 30 pages * of 100). Anything older is undated and prunes first, which is the right * answer for a bundle thousands of publishes old. */ maximumCommitPages?: number; maximumAttempts?: number; nowEpochSeconds?: number; fetchImplementation?: typeof fetch; sleepImplementation?: (milliseconds: number) => Promise; log?: (line: string) => void; }; export type MapStorePruneResult = { /** True when the branch was rewritten (a compaction commit was pushed). */ compacted: boolean; retainedDirectoryNames: string[]; prunedDirectoryNames: string[]; }; /** Prune stale bundles and squash the map store branch to a single commit. * Retries transient API faults; a missing branch and a nothing-to-do run are * both successes. */ export declare function compactMapStoreBranch(options: MapStorePruneApiOptions): Promise;