Skip to content

Commit 8b0ff11

Browse files
committed
mason: delete proven-dead modules & functions from 2026-07-25 audit
Executes the PROVEN-DEAD deletion batch from .alfonso/dead-modules-2026-07-25.md (merged on master). Each target was re-verified with a fresh search for importers/callers before deletion. Deleted (1328 lines total): - 8 dead module files + 1 co-located test (960 lines): transcript-opencode.ts (302), plugin-messages.ts (237), opencode-compaction-detector.ts (81) plus its test (239, covered only that module), compartment-runner-state-xml.ts (83), cli opencode-install.ts (10), and 3 dead barrels: config/schema.ts, tools/index.ts, pi-plugin src/storage.ts. - 31 dead exported functions/types/constants across 23 live modules (368 lines), incl. 4 named re-export lines removed from git-commits/index.ts (upsertCommit, evictOldestCommits, getCommitBySha, clearProjectCommitEmbeddings). Gates: plugin tests 3251 pass / 0 fail; pi-plugin 710 pass / 0 fail; cli 276 pass; lint (biome) pass; tsc --noEmit pass for plugin, pi-plugin, cli; bun run build:dists pass. Report false-positives found (NOT deleted - have live consumers today): - mock-database.ts: imported by 3 live tests (storage-meta, tagger, compaction). - issue-135-wire-fixtures.ts: imported by openai-compat-adjacency.test.ts. - features/magic-context/index.ts barrel: imported by tools/ctx-memory/tools.test.ts; its re-exported sub-barrels dreamer/, sidekick/, smart-notes/ index.ts stay as well because deleting them breaks the kept barrel. - updatePinnedVersion (auto-update-checker/checker.ts): used by checker.test.ts. - getAutoUpdateInstallDir (auto-update-checker/index.ts): used by index.test.ts. Pre-existing baseline failures (not caused by this change, verified against the base commit): - plugin scripts tsconfig: scripts/backfill-embeddings.ts imports getShadowBackfillStopReason from memory/embedding.ts, which never exported it (the symbol lives in project-embedding-registry.ts); absent at base. - cli: 4 timeouts in opencode-helpers/pi-helpers process-spawning tests, reproduced with the cli deletion reverted (environmental).
1 parent cf7f53e commit 8b0ff11

32 files changed

Lines changed: 0 additions & 1328 deletions

packages/cli/src/lib/opencode-install.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/pi-plugin/src/commands/ctx-status.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,3 @@ function readHistorianState(
199199
failureCount: row?.historian_failure_count ?? 0,
200200
};
201201
}
202-
203-
export function formatCtxStatusSummary(details: CtxStatusDetails): string {
204-
return [
205-
"## Magic Status",
206-
"",
207-
`**Session:** ${details.sessionId}`,
208-
`**Project:** ${details.projectIdentity}`,
209-
`**Tags:** ${details.activeTags} active (${formatBytes(details.totalBytes)}), ${details.droppedTags} dropped`,
210-
`**Pending ops:** ${details.pendingOps}`,
211-
`**Compartments:** ${details.compartmentCount}${details.lastCompartmentRange ? ` (last ${details.lastCompartmentRange})` : ""}`,
212-
`**Memories:** ${details.memoryCount}`,
213-
`**Notes:** ${details.noteCount}`,
214-
`**Dreamer:** ${details.dreamer.enabled ? `enabled (${details.dreamer.scheduleSummary?.trim() ? details.dreamer.scheduleSummary : "manual-only"})` : "disabled"}`,
215-
`**Historian:** ${details.historian.inProgress ? "running" : "idle"}, failures=${details.historian.failureCount}`,
216-
].join("\n");
217-
}

packages/pi-plugin/src/inject-compartments-pi.ts

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,102 +2657,3 @@ export interface PiInjectionResult {
26572657
memoryCount: number;
26582658
skippedVisibleMessages: number;
26592659
}
2660-
2661-
/**
2662-
* Prepare and write the `<session-history>` block into a Pi message
2663-
* array. Owns the full inject lifecycle: builds the projection, calls
2664-
* the shared prepareCompartmentInjection, applies the boundary trim
2665-
* back to Pi messages, and writes the rendered block into the first
2666-
* user message.
2667-
*
2668-
* Caller MUST manage `isCacheBusting` via the shared
2669-
* `historyRefreshSessions` signal — same contract as OpenCode. On defer
2670-
* passes (`isCacheBusting=false`) the shared injection cache replays
2671-
* the previous result so provider prompt cache stays stable.
2672-
*/
2673-
export function injectSessionHistoryIntoPi(
2674-
db: ContextDatabase,
2675-
sessionId: string,
2676-
piMessages: PiAgentMessage[],
2677-
isCacheBusting: boolean,
2678-
projectPath: string | undefined,
2679-
injectionBudgetTokens: number | undefined,
2680-
temporalAwareness: boolean | undefined,
2681-
entryIds?: readonly (string | undefined)[],
2682-
): PiInjectionResult {
2683-
// Project Pi messages into a MessageLike[] so the shared trimmer can
2684-
// find the cutoff by synthesized id. Mutations to the projection are
2685-
// intentionally discarded — we re-do the trim against piMessages
2686-
// using the boundary id the shared call returns.
2687-
const projection = buildMessageLikeProjection(piMessages, entryIds);
2688-
const beforeProjectionLen = projection.length;
2689-
const prepared: PreparedCompartmentInjection | null =
2690-
prepareCompartmentInjection(
2691-
db,
2692-
sessionId,
2693-
projection,
2694-
isCacheBusting,
2695-
projectPath,
2696-
injectionBudgetTokens,
2697-
temporalAwareness,
2698-
);
2699-
2700-
if (!prepared) {
2701-
return {
2702-
injected: false,
2703-
compartmentCount: 0,
2704-
factCount: 0,
2705-
memoryCount: 0,
2706-
skippedVisibleMessages: 0,
2707-
};
2708-
}
2709-
2710-
// Apply the same boundary trim the shared call performed on the
2711-
// projection, but back to the real Pi message array. The projection
2712-
// already reflects the trim (its length shrank); we use the cached
2713-
// boundary id to do the equivalent trim on Pi.
2714-
//
2715-
// `compartmentEndMessageId` is nullable: a non-null non-empty value
2716-
// means "trim Pi messages to this boundary"; null/empty means "no
2717-
// trim" (either fresh session with no compartments yet, or the
2718-
// degraded-cache path where the boundary message is missing from
2719-
// the visible array).
2720-
const boundaryId = prepared.compartmentEndMessageId;
2721-
const skippedVisible =
2722-
boundaryId != null && boundaryId.length > 0
2723-
? trimPiMessagesToBoundary(piMessages, entryIds, boundaryId)
2724-
: prepared.skippedVisibleMessages;
2725-
2726-
// Render: write the prepared block into Pi message[0]'s first text
2727-
// content. `prepared.block` is the inner XML; the wrapper tags are
2728-
// added here so the format matches OpenCode exactly.
2729-
const historyBlock = `<session-history>\n${prepared.block}\n</session-history>`;
2730-
const wrote = injectHistoryBlockIntoFirstUserMessage(
2731-
piMessages,
2732-
historyBlock,
2733-
);
2734-
2735-
if (wrote) {
2736-
const memoryLabel =
2737-
prepared.memoryCount > 0 ? ` + ${prepared.memoryCount} memories` : "";
2738-
if (prepared.compartmentCount > 0) {
2739-
logSession(
2740-
sessionId,
2741-
`injected ${prepared.compartmentCount} compartments + ${prepared.factCount} facts${memoryLabel} into message[0] (skipped ${skippedVisible}/${beforeProjectionLen} visible messages)`,
2742-
);
2743-
} else {
2744-
logSession(
2745-
sessionId,
2746-
`injected ${prepared.factCount} facts${memoryLabel} into message[0] (no compartments yet)`,
2747-
);
2748-
}
2749-
}
2750-
2751-
return {
2752-
injected: wrote,
2753-
compartmentCount: prepared.compartmentCount,
2754-
factCount: prepared.factCount,
2755-
memoryCount: prepared.memoryCount,
2756-
skippedVisibleMessages: skippedVisible,
2757-
};
2758-
}

packages/pi-plugin/src/storage.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/plugin/src/config/schema.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

packages/plugin/src/config/schema/magic-context.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ export const DEFAULT_LOCAL_EMBEDDING_MODEL = "Xenova/all-MiniLM-L6-v2";
2727
// scheduler share ONE source of truth for task names. DreamingTask remains the
2828
// agentic tasks (those driven by buildDreamTaskPrompt); CANONICAL_DREAM_TASKS
2929
// is the full task set used for per-task scheduling config.
30-
export const DREAMER_TASKS = AGENTIC_DREAM_TASKS;
31-
export const DreamingTaskSchema = z.enum(AGENTIC_DREAM_TASKS);
3230
export type DreamingTask = (typeof AGENTIC_DREAM_TASKS)[number];
3331

3432
/** Valid thinking levels for Pi subagents. Maps to Pi's --thinking CLI flag.

packages/plugin/src/features/magic-context/compartment-chunk-embedding.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -842,30 +842,6 @@ export function replaceCompartmentChunkEmbeddings(
842842
);
843843
}
844844

845-
export function getDistinctChunkEmbeddingModelIds(
846-
db: Database,
847-
projectPath: string,
848-
): Set<string | null> {
849-
const rows = getDistinctModelStatement(db).all(projectPath) as StoredModelIdRow[];
850-
return new Set(rows.map((row) => (typeof row.modelId === "string" ? row.modelId : null)));
851-
}
852-
853-
export function clearChunkEmbeddingsForProject(
854-
db: Database,
855-
projectPath: string,
856-
modelId?: string,
857-
): number {
858-
const changes = modelId
859-
? getClearProjectModelStatement(db).run(projectPath, modelId).changes
860-
: getClearProjectStatement(db).run(projectPath).changes;
861-
invalidateDecodedSearchPools(
862-
db,
863-
([, cachedProjectPath, cachedModelId]) =>
864-
cachedProjectPath === projectPath && (!modelId || cachedModelId === modelId),
865-
);
866-
return changes;
867-
}
868-
869845
export function loadCompartmentChunkEmbeddingsForSearch(
870846
db: Database,
871847
sessionId: string,

packages/plugin/src/features/magic-context/dreamer/task-registry.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ export type DreamTaskName = (typeof CANONICAL_DREAM_TASKS)[number];
3636
*/
3737
export const AGENTIC_DREAM_TASKS = ["curate", "maintain-docs"] as const;
3838

39-
export type AgenticDreamTask = (typeof AGENTIC_DREAM_TASKS)[number];
40-
4139
/**
4240
* Tasks that read-modify-write the project `memories` table (+ epoch +
4341
* supersede-delta rows). They SHARE one per-project "memory" lease so they

packages/plugin/src/features/magic-context/git-commits/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,16 @@ export {
1313
searchGitCommitsSync,
1414
} from "./search-git-commits";
1515
export {
16-
clearProjectCommitEmbeddings,
1716
countEmbeddedCommits,
1817
loadProjectCommitEmbeddings,
1918
loadUnembeddedCommits,
2019
saveCommitEmbedding,
2120
} from "./storage-git-commit-embeddings";
2221
export {
2322
enforceProjectCap,
24-
evictOldestCommits,
25-
getCommitBySha,
2623
getCommitCount,
2724
getLatestIndexedCommitTimeMs,
2825
type StoredGitCommit,
29-
upsertCommit,
3026
upsertCommits,
3127
} from "./storage-git-commits";
3228
export {

packages/plugin/src/features/magic-context/git-commits/storage-git-commit-embeddings.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -169,22 +169,3 @@ export function countEmbeddedCommits(db: Database, projectPath: string, modelId:
169169
| undefined;
170170
return row?.count ?? 0;
171171
}
172-
173-
export function clearProjectCommitEmbeddings(
174-
db: Database,
175-
projectPath: string,
176-
modelId?: string,
177-
): number {
178-
if (modelId) {
179-
return getClearProjectModelStatement(db).run(modelId, projectPath).changes;
180-
}
181-
return getClearProjectStatement(db).run(projectPath).changes;
182-
}
183-
184-
export function getDistinctCommitEmbeddingModelIds(
185-
db: Database,
186-
projectPath: string,
187-
): Set<string | null> {
188-
const rows = getDistinctModelIdStatement(db).all(projectPath) as StoredCommitModelIdRow[];
189-
return new Set(rows.map((row) => (typeof row.modelId === "string" ? row.modelId : null)));
190-
}

0 commit comments

Comments
 (0)