mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
refactor: remove legacy seams and consolidate resource ownership (#10349)
This commit is contained in:
1 parent
5cddc69c51
commit
bbe2bcc979
301 files changed
+3148
-2804
No files matched your search
@@ -111,36 +111,6 @@ interface FileContext extends SemanticFlowProjectionContext {
|
||||
>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource-safety ceiling on retained semantic nodes.
|
||||
*
|
||||
* The semantic projection emits one node per AST expression, call site, binding
|
||||
* and property slot. That is unbounded in input size. A small tree of five files
|
||||
* already yields on the order of 170,000 nodes, and larger trees yield millions,
|
||||
* exhausting the heap before the result can be serialized.
|
||||
*
|
||||
* This is a real resource-safety constraint, not a presentation preference, so
|
||||
* the ceiling is applied and reported through the graph's own `coverage` fields
|
||||
* (`truncated`, `omitted_nodes`, `omitted_relations`, `limits`) rather than
|
||||
* silently dropping data.
|
||||
*
|
||||
* Defaults bound work even when ample heap is available. Callers may raise the
|
||||
* capacities explicitly; isolated worker heap, bounded record transport and
|
||||
* parent result admission independently constrain actual retained memory. The
|
||||
* result uses incremental serialization rather than a single JSON string.
|
||||
*/
|
||||
export const SEMANTIC_GRAPH_NODE_CEILING =
|
||||
JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS.semanticNodes;
|
||||
|
||||
/**
|
||||
* Per-file share of the semantic node budget.
|
||||
*
|
||||
* Bound each source file independently so one large bundled library cannot
|
||||
* consume the whole tree's budget and starve the application's own modules.
|
||||
*/
|
||||
export const SEMANTIC_GRAPH_FILE_NODE_CEILING =
|
||||
JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS.semanticNodesPerFile;
|
||||
|
||||
/** File-local semantic projection that does not retain consumed source IR. */
|
||||
export interface JavaScriptSemanticGraphProjection {
|
||||
/** Node capacity offered to the next independently analyzed source file. */
|
||||
@@ -216,8 +186,12 @@ export const createJavaScriptSemanticGraphProjection = (
|
||||
readonly fileUnknowns?: number;
|
||||
} = {},
|
||||
): JavaScriptSemanticGraphProjection => {
|
||||
const nodeCeiling = limits.totalNodes ?? SEMANTIC_GRAPH_NODE_CEILING;
|
||||
const fileNodeCeiling = limits.fileNodes ?? SEMANTIC_GRAPH_FILE_NODE_CEILING;
|
||||
// Bound total and per-file work so a large dependency cannot starve the graph.
|
||||
const nodeCeiling =
|
||||
limits.totalNodes ?? JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS.semanticNodes;
|
||||
const fileNodeCeiling =
|
||||
limits.fileNodes ??
|
||||
JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS.semanticNodesPerFile;
|
||||
const unknownCeiling =
|
||||
limits.totalUnknowns ??
|
||||
JAVASCRIPT_ANALYSIS_RESOURCE_DEFAULTS.semanticUnknowns;
|
||||
|
||||
Reference in new issue
Block a user