/** * Entity scope repair — one-time backfill for graph entities whose `scope` * property was overwritten by the pre-fix last-writer-wins upsert. * * The graph auto-populator stamps every file and symbol entity with the scope * of the decision that touched it. Before utils/entity-properties.ts made * `scope` a union, a later decision in a different scope silently replaced the * earlier value — so an entity ended up asserting a single scope that was * merely the most recent one, and often contradicted its own path. Measured on * the dogfood repo: 110 of 242 scoped file entities carried a scope their own * name did not start with. * * The lost information is recoverable because the auto-populator also writes a * `decided_by` relation from each file/symbol entity to the decision entity * that touched it, and the decision entity carries that decision's scope in its * own properties. Unioning those gives back the full set. * * Repair is opt-in and dry-run by default, matching the rest of housekeeping. */ import type { IGraphStore } from "../storage/interfaces.js"; export interface EntityScopeRepairItem { entity: string; type: string; before: string; after: string; } export interface EntityScopeRepairReport { /** Entities examined (file and symbol entities carrying a scope). */ examined: number; /** Entities whose recovered scope set differs from what is stored. */ repairable: number; /** Entities actually rewritten (0 unless execute). */ repaired: number; /** Sample of the changes, capped for readable output. */ items: EntityScopeRepairItem[]; dry_run: boolean; } /** * Recompute entity scopes from `decided_by` relations. * * The recovered set is the union of the stored scope (never dropped — it is a * real observation, just an incomplete one) and the scopes of every decision * entity this entity points at. */ export declare function repairEntityScopes(graphStore: IGraphStore, options?: { execute?: boolean; }): Promise; //# sourceMappingURL=entity-scope-repair.d.ts.map