angular-bundle: budgets/webpack validators call methods that do not exist; the TypeError is swallowed and 'missing' is always reported
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- angular, node.js, typescript
Línea de trabajo
Start with src/utils/angular/angular-bundle/angular-bundle-validation-patterns.ts, src/laws/performance/performance-budget-compliance.ts, and src/utils/angular/angular-bundle/angular-bundle-optimization-analyzer.ts to trace the validators and their callers. Add a regression test using an angular.json with configured production budgets, then run the relevant tests. Done means configured budgets no longer produce the “missing” suggestion and failures to read configuration are reported explicitly.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Version: 7.29.1 (npm latest, 5fc54afe). Same code on develop (2d2fa9a).
Area: src/utils/angular/angular-bundle/angular-bundle-validation-patterns.ts (used by the Lazy Loading Implementation checker through AngularBundleOptimizationAnalyzer.checkBundleOptimization)
What happens
validatePerformanceBudgets and validateWebpackConfiguration cast PerformanceBudgetComplianceLaw with as unknown as { … } and call two methods it does not have:
// angular-bundle-validation-patterns.ts:94-99 (and :123-129 for the webpack one)
const law = PerformanceBudgetComplianceLaw as unknown as {
checkAngularPerformanceBudgets: (projectRoot: string) => { configured: boolean };
};
const budgetAnalysis = law.checkAngularPerformanceBudgets(projectRoot); // undefined is not a function
...
} catch {
suggestions.push(PERFORMANCE_BUDGETS_MISSING().suggestionMessage); // the TypeError lands here
}
PerformanceBudgetComplianceLaw only has static async check(context) (src/laws/performance/performance-budget-compliance.ts:30). Every call therefore throws a TypeError. The catch swallows it and adds the "missing" suggestion, whatever the project actually configures. The double cast is what keeps the compiler from reporting it.
Reproduction (published 7.29.1 dist)
A temp directory whose angular.json has a production budgets entry (initial, 500kb / 1mb), called directly against dist/utils/angular/angular-bundle/angular-bundle-validation-patterns.js:
PerformanceBudgetComplianceLaw own static members: [ 'check' ]
typeof checkAngularPerformanceBudgets: undefined | typeof checkWebpackPerformanceConfig: undefined
budgets configured in angular.json -> validatePerformanceBudgets suggestions: ["Add performance budgets in angular.json build configuration"]
validateWebpackConfiguration suggestions: ["Configure webpack performance settings and optimization"]
What I ruled out
- This is not a test-only path: the Lazy Loading Implementation checker calls
AngularBundleOptimizationAnalyzer.checkBundleOptimization, which calls both validators (angular-bundle-optimization-analyzer.ts:47,51). - I did not measure whether the suggestion changes the law's pass/fail verdict or only its suggestions text. I only proved that the output is independent of the project.
Why it matters
The output claims budgets are missing in a project that configures them, and the catch hides the reason. This is the opposite of the tool's own rule of saying when it could not judge something. It was found in the 8.0.0 self-audit triage: the No Double Cast law flags these two casts, and they are real debt, not a detector error.
Suggested direction
- Call real code: either expose a budget/webpack reader (for example in
src/utils/angular/) that both this analyzer andPerformanceBudgetComplianceLawuse, or readangular.jsonbudgets directly here. - Drop the
as unknown ascasts and the barecatch. An unreadableangular.jsonshould become an explicit "not read" note, not a "missing" suggestion. - Add a regression test with a configured budget that expects no "missing" suggestion. Today it would fail.
- Lenguaje dominante
- TypeScript
- Estrellas
- 0
- Forks
- 0
- Merge medio
- 38 min
- PR fusionados (30 d)
- 96
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Rule-Of-Code/RoC
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Rule-Of-Code/RoC#436 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Rule-Of-Code/RoC#439 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 49/100
Rule-Of-Code/RoC#438 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 53/100
Rule-Of-Code/RoC#437 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 74/100
Rule-Of-Code/RoC#435 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Rule-Of-Code/RoC
Issues similares
-
ready-for-agent
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
LucasSantana-Dev/Lucky#3257 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
XiaomiMiMo/MiMo-Code#2849 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
danielmiessler/LifeOS#2894 ·
Los mantenedores suelen responder en 5 días
-
enhancement frontend good first issue help wanted testing-infrastructure
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
-
enhancement follow-up
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día