mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-18 04:43:36 +00:00
Each exportPattern matcher has its own work cap, but nothing bounded how many patterns a repository may carry, so a NAMESPACE with 200 pathological patterns cost about 77 s of analysis and one with tens of thousands of cheap patterns cost minutes and gigabytes. loadRPackageConfig now creates one SharedWorkBudget per call and a sub-budget per package. Every matcher draws on its package's sub-budget and on the load's: state visits spent matching (100M per load, 30M per package) and NFA states kept by compiled patterns (500k per load, 100k per package). A pattern that does not fit the state allowance is refused before its NFA is fully built, and the first refusal closes the allowance so later patterns are refused without being parsed. Once the matching budget is spent, refineRExportStatus and the R import resolver stop calling the matchers. Refused and cut-short patterns take the existing drop-and-warn path (export nothing), with at most 50 named per package and one summary line for the rest. A hostile package can therefore not starve the packages after it. Budgets count work units, so the outcome is deterministic. Benign monorepos spend a negligible fraction of every budget. |
||
|---|---|---|
| .. | ||
| cli | ||
| config | ||
| core | ||
| lib | ||
| mcp | ||
| server | ||
| storage | ||
| types | ||
| utils | ||