import type { Residue } from '../../domain.objects/Residue'; /** * the default age past which a temp entry is reclaimed * * .why = 24 hours. a wider window buys only a MARGIN AGAINST A GUESS, and this * gate need not guess: the run marker records a pid and a start time, so * ownership has an answer. * * .note = the gate is the BACKSTOP, not the policy. the policy is the run's own * teardown, which reclaims within the run. this catches what a signal, an * OOM, or an unhooked consumer leaves behind */ export declare const MAX_AGE_MS_DEFAULT: number; /** * the env key a consumer sets to widen or narrow the gate * * .why = a suite that genuinely runs long, or a human who inspects a held dir * across a weekend, needs more than a day. the window is a default, not a law */ export declare const MAX_AGE_ENV_KEY = "TEST_FNS_MAX_AGE_MS"; /** * .what = the account of one age-gate pass * .why = a caller must be able to assert what the gate took and what resisted; * a gate that reports only "done" cannot be told from one that never fired */ export interface PruneStaleAudit { /** the aged dirs it removed */ dirsReclaimed: string[]; /** the aged run markers it removed */ markersReclaimed: string[]; /** what it could not remove, each with the reason */ residue: Residue[]; /** * the dir names it could not parse, and so preserved * * .why = a mint that produces unparseable names turns this gate OFF, and every * run still looks green. the count is the only signal that would show it */ namesUnreadable: string[]; } /** * .what = reads the configured max-age window * .why = the default is 24h; a consumer may widen it for a long suite * * .note = maxAge, never staleAge. the THRESHOLD is a max age; the dirs PAST it * are stale. one concept, one word (`rule.require.ubiqlang`) */ export declare const getOneMaxAgeMs: () => number; /** * .what = removes entries older than threshold from tmpDir — dirs AND run markers * .why = reclaims disk space from stale test directories, and from the markers of * runs that were pre-empted before their own teardown could settle them * * .note = TWO passes, and the second is not optional. a marker is a FILE, so the * dir pass skips it by construction — without an explicit marker pass, a * pre-empted run's marker would survive forever and the guard against a * leak would itself leak * * @returns the audit; it never throws on a single entry it cannot remove */ export declare const pruneStale: (input: { tmpDir: string; maxAgeMs?: number; }) => Promise; /** * .what = speaks the age gate's residue to the human, or says no word when clean * .why = ONE renderer for two triggers — the unhooked one here, the enhooked one in * the setup adapter. the same gate reports the same audit, so a second copy * of these lines would be a second voice free to drift with no signal at * all. a message a human reads is a contract like any other * * .note = it takes the audit rather than the lines, so a caller cannot report a * residue it did not receive */ export declare const reportStaleResidue: (input: { audit: PruneStaleAudit; }) => void; /** * .what = speaks the names the age gate could not parse, or says no word when none * .why = a name the gate cannot read is PRESERVED — correct, since we may not have * minted it — but never in SILENCE. an unreadable name is the one shape that * makes a dir immortal: no run's id claims it, and no age check can read it, * so it is the exact residue class a human must be told about (case=14, E4) * * .note = it lives HERE, beside `reportStaleResidue`, rather than inline in the * setup adapter that calls it. it is the third member of one message family * — "N entries could not be read, here they are, remove them by hand" — and * a named renderer is what lets a snapshot exercise it directly. an inline * render is a contract no test can reach without it drives the whole * operation around it * * .note = it takes the AUDIT rather than the lines, so a caller cannot report a set * of names it did not receive */ export declare const reportUnreadableNames: (input: { audit: PruneStaleAudit; /** the root the names sit in — the address the human is sent to */ tmpDir: string; }) => void; /** * .what = runs pruneStale at most once per RUN, and reports what resisted * .why = prevents redundant filesystem scans across multiple genTempDir calls * * .note = this is the UNHOOKED consumer's only reclaim, so it must not block the * genTempDir call that triggers it. an enhooked consumer fires the gate * once at their global setup instead, where it CAN be awaited * * .note = it never swallows. a residue the gate cannot take is reported to stderr * rather than hidden — silence here is what lets dirs accrue unseen * * .note = the skip is decided HERE, never by the caller. this operation knows its * own sweep state, so every call site is unconditional * (`rule.require.fewer-paths-via-idempotency`: do not branch around an * operation — make the operation safe, then collapse the path) */ export declare const pruneStaleOnce: (input: { tmpDir: string; maxAgeMs?: number; }) => Promise; /** * .what = resets the prune throttle flag * .why = enables tests to verify throttle behavior * * @internal - only for test use */ export declare const resetPruneThrottle: () => void; /** * .what = checks if prune has run this process * .why = enables tests to verify throttle behavior * * @internal - only for test use */ export declare const hasPrunedThisProcess: () => boolean;