chore: remove ten unused exports flagged by the dead-code gate (#19230)

Audited: no live consumer of the ten removed exports. `tests/unit/removed-dead-exports-surface.test.ts` pins the kept and removed names per module.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-11-06 19:56:53 -03:00
committed by GitHub
parent 7bef65b3aa
commit 8aaffff52c
12 changed files with 43 additions and 65 deletions

View File

@@ -0,0 +1 @@
- **chore:** removed 10 unused exports flagged by the `dead-code` gate during the v3.8.53 cycle, plus the `fileExists` helper that only one of them used.

View File

@@ -22,7 +22,7 @@ export interface PreferredConnectionsSectionProps {
* are listed: the preference is a ranking hint evaluated after the normal eligibility
* pipeline, never an access grant.
*/
export const PreferredConnectionsSection = memo(function PreferredConnectionsSection({
const PreferredConnectionsSection = memo(function PreferredConnectionsSection({
connections,
allowAllConnections,
selectedConnections,

View File

@@ -133,19 +133,6 @@ export const PROVIDER_SPECIFIC_RESPONSE_ONLY_FIELDS = [
export type ProviderSpecificSecretField = (typeof PROVIDER_SPECIFIC_SECRET_FIELDS)[number];
/**
* True for a key that holds a credential even though it is not a fixed name in
* PROVIDER_SPECIFIC_SECRET_FIELDS: WordPress names its session cookie
* `wordpress_logged_in_<siteHash>`, so veoaifree-web rows may store any suffixed variant
* (open-sse/utils/wordpressSessionKey.ts, #17041).
*/
export function isProviderSpecificSecretKey(key: string): boolean {
return (
(PROVIDER_SPECIFIC_SECRET_FIELDS as readonly string[]).includes(key) ||
isWordPressLoggedInKey(key)
);
}
/** Declared secret fields plus any dynamically-named secret key present in `data`. */
export function providerSpecificSecretKeysIn(data: Record<string, unknown>): string[] {
const keys: string[] = [...PROVIDER_SPECIFIC_SECRET_FIELDS];

View File

@@ -201,5 +201,3 @@ export const freebuff = {
},
}),
};
export default freebuff;

View File

@@ -39,7 +39,6 @@ export {
normalizeSource,
type CanonicalNode,
type NormalizeFail,
type NormalizeOk,
type NormalizeResult,
} from "./normalize";

View File

@@ -50,7 +50,6 @@ export type {
WaitForCooldownSettings,
ComboCooldownWaitSettings,
QuotaShareConcurrencyLimitSettings,
P2CLatencySettings,
ProviderCooldownSettings,
QuotaPreflightSettings,
StreamRecoverySettings,

View File

@@ -64,12 +64,6 @@ function pruneCache(): void {
}
}
export function invalidateSsoResolution(oid: string): void {
for (const [key, entry] of resolutionCache) {
if (entry.oid === oid) resolutionCache.delete(key);
}
}
export { looksLikeEntraJwt };
/**

View File

@@ -37,21 +37,6 @@ function createDateFormatter(locale: string, options: Intl.DateTimeFormatOptions
}
}
// ── Sort Indicator (shared by tables) ──────────────────────────────────────
export function SortIndicator({ active, sortOrder }: { active: boolean; sortOrder: string }) {
if (!active) {
return <Icon name="unfold_more" size={12} className="opacity-0 group-hover:opacity-30" />;
}
return (
<Icon
name={sortOrder === "asc" ? "expand_less" : "expand_more"}
size={12}
className="text-primary"
/>
);
}
// ── StatCard (primary KPI) ─────────────────────────────────────────────────
export function StatCard({

View File

@@ -6,10 +6,9 @@
* - AccountDonut.js, ApiKeyDonut.js, ProviderCostDonut.js
* - ApiKeyTable.js, ModelTable.js
* - WeeklyPattern.js, MostActiveDay7d.js, WeeklySquares7d.js
* - UsageDetail.js, SortIndicator.js
* - UsageDetail.js
*/
export {
SortIndicator,
StatCard,
CompactStatGrid,
ActivityHeatmap,

View File

@@ -8,7 +8,7 @@ export { default as Textarea } from "./Textarea";
export { default as Card } from "./Card";
export { default as Collapsible } from "./Collapsible";
export { default as Modal, ConfirmModal, TALL_MODAL_PROPS } from "./Modal";
export { default as Loading, Spinner, PageLoading, Skeleton, CardSkeleton } from "./Loading";
export { Spinner, PageLoading, Skeleton, CardSkeleton } from "./Loading";
export { default as Avatar } from "./Avatar";
export { default as Badge } from "./Badge";
export { default as Toggle } from "./Toggle";

View File

@@ -74,11 +74,6 @@ export function getPiModelsPath(env: NodeJS.ProcessEnv = process.env): string {
return path.join(getPiAgentDir(env), "models.json");
}
/** Path to the agent-level settings.json (theme, changelog, …). Read-only here. */
export function getPiSettingsPath(env: NodeJS.ProcessEnv = process.env): string {
return path.join(getPiAgentDir(env), "settings.json");
}
function getPiHome(env: NodeJS.ProcessEnv = process.env): string {
// Prefer $HOME (what the API routes and Pi agree on); os.homedir() is the
// fallback for platforms that leave it unset.
@@ -92,15 +87,6 @@ function expandTilde(value: string, env: NodeJS.ProcessEnv): string {
return path.join(home, value.slice(1));
}
async function fileExists(filePath: string): Promise<boolean> {
try {
await fs.access(filePath);
return true;
} catch {
return false;
}
}
function isPlainObject(value: unknown): value is Record<string, unknown> {
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
}
@@ -371,12 +357,3 @@ export async function removeOmniRoutePiProvider(
return { removed: true, modelsPath };
}
/** Surface whether the agent dir + models.json exist, for the dashboard summary. */
export async function getPiconfigPresence(
env: NodeJS.ProcessEnv = process.env
): Promise<{ modelsPath: string; agentDir: string; modelsFileExists: boolean }> {
const agentDir = getPiAgentDir(env);
const modelsPath = getPiModelsPath(env);
return { modelsPath, agentDir, modelsFileExists: await fileExists(modelsPath) };
}

View File

@@ -0,0 +1,39 @@
import assert from "node:assert/strict";
import { test } from "node:test";
// Pins the public surface of the modules that lost their unused exports, so a
// removal cannot take a live export with it and a dead one does not creep back.
const SURFACES = [
{
path: "../../src/shared/services/piConfig.ts",
kept: ["getPiAgentDir", "getPiModelsPath", "readPiModelsJson"],
removed: ["getPiSettingsPath", "getPiconfigPresence"],
},
{
path: "../../src/lib/db/providers/providerSpecificDataSecrets.ts",
kept: ["providerSpecificSecretKeysIn", "mapProviderSpecificDataSecrets"],
removed: ["isProviderSpecificSecretKey"],
},
{
path: "../../src/lib/oauth/providers/freebuff.ts",
kept: ["freebuff", "generateFreebuffFingerprintId"],
removed: ["default"],
},
{
path: "../../src/server/authz/entra/evaluate.ts",
kept: ["evaluateSsoAuth", "resetSsoResolutionCache"],
removed: ["invalidateSsoResolution"],
},
];
for (const { path, kept, removed } of SURFACES) {
test(`${path} keeps its live exports and not the removed ones`, async () => {
const mod = await import(path);
for (const name of kept) {
assert.equal(typeof mod[name] === "undefined", false, `${name} must stay exported`);
}
for (const name of removed) {
assert.equal(name in mod, false, `${name} must stay removed`);
}
});
}