Skip to content

Enable strictTemplates across frontend packages - #5622

Merged
norman-abramovitz merged 6 commits into
cloudfoundry:developfrom
nabramovitz:strict-templates-5618
Jul 11, 2026
Merged

Enable strictTemplates across frontend packages#5622
norman-abramovitz merged 6 commits into
cloudfoundry:developfrom
nabramovitz:strict-templates-5618

Conversation

@nabramovitz

Copy link
Copy Markdown
Contributor

Closes #5618.

What

Turns on Angular strictTemplates for every frontend package and fixes the 557 template type errors that flipping the flag surfaced. strictTemplates was disabled during the Angular 22 + TypeScript 6.0 upgrade so the codebase would compile through the migration (cdaf000); this pays down that debt.

Why

Template expressions have never been type-checked while the flag was off. That is exactly how the second defect on #5600 (a template reading the legacy v2 entity.* / metadata.guid shape over a stream now emitting flat v3 rows) compiled clean and survived several v2/ngrx removal sweeps — those scans key on imports, URLs and store APIs, none of which see plain HTML. With the flag on, that whole bug class can no longer compile silently.

Shape of the change

Commits are grouped per package for review:

  1. core — nullable inputs, widened setters that already guarded at runtime, missing standalone imports, privateprotected for template-read members
  2. store + git
  3. cloud-foundry
  4. kubernetes
  5. cf-autoscaler — includes restoring the metric chart card broken by the earlier ngx-charts→Chart.js migration (gauge + combo-chart inputs reimplemented)
  6. the flag flip itself (six package tsconfigs)

The per-package tsconfigs override the root, so each needed the flip; the app build compiles all packages from source, so core/tsconfig.app.json is what actually gates CI.

Real defects the checker exposed (fixed here, not silenced)

The point of the flag is catching these, and it did:

  • application-delete rendered blank service-instance names — a template reading binding.serviceInstanceName (never existed) instead of binding.serviceInstance.name. The Binding marketplace service instance - Service instances not showing #5600 v2-shape class.
  • endpoint name-uniqueness validation was dead — a template typo (existingEndpoinNames$) that silently disabled the check.
  • deploy-application branch <select> bound the whole GitBranch object with [value] (no [ngValue]), so the DOM value was "[object Object]" and overwrote the typed model — branch switching was broken.
  • kubedash config bound raw booleans to a busy input piped through | async, so the busy overlay never worked.
  • cf-autoscaler combo-chart read the old ngx-charts multi-series shape after the Chart.js rewrite and would have thrown once metric data arrived.
  • unique-name status icon had rendered nothing since the StratosStatus migration (done stopped matching any state key).
  • Latent null-crash on the home endpoint-card favourite star; several dead bindings removed.

No any

Fixes are root-cause: correct the producer type, optional-chain, narrow with @if, or widen an input that genuinely accepts undefined. No $any() / as any / blanket non-null assertions were used to reach green.

Verification

make check gate green (3094 tests pass, 0 fail); full ng build clean with the flag on.

Draft

Draft pending live UI verification of the restored cf-autoscaler chart and the deploy branch select.

Producer-side type corrections (nullable inputs, widened setters that
already guarded at runtime), missing standalone component imports, and
private->protected for template-read members. Restores endpoint-name
uniqueness validation (template typo), the theme selector's current
value, and removes a latent null crash on the home endpoint card.
Adds backend-verified Diagnostics.databaseBackend, exports Diagnostics,
GitUser.name (GitLab owner mapping), and null-safe git template reads.
Missing AppErrorComponent/card imports, null-safe async reads, and real
defect repairs the checker exposed: application-delete rendered blank
service-instance names (v2-shape read), the deploy-app branch select
wrote '[object Object]' into the model (now ngValue), select-plan lost
its card border and accessibility strip, and the unique-name check icon
had been dead since the StratosStatus migration.
Missing standalone imports on live routed components, null-safe reads,
typed popeye/kube-score report shapes, and a real fix: kubedash config
bound raw booleans to an async-piped busy input, so the busy overlay
never worked. Removes a provably dead dashboard spinner branch.
Restores the metric chart card broken by the ngx-charts to Chart.js
migration: reimplements the doughnut gauge (latest reading vs max,
threshold-colored), rewires 11 combo-chart inputs into Chart.js config,
and fixes the data-shape mismatch that would throw once metrics
arrived. Also form-control null guards and protected template members.
Template expressions are now type-checked; the v2-to-v3 shape bug class
(cloudfoundry#5600) can no longer compile silently.

Closes cloudfoundry#5618
@nabramovitz
nabramovitz marked this pull request as ready for review July 11, 2026 07:03

@norman-abramovitz norman-abramovitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@norman-abramovitz
norman-abramovitz merged commit ebc20a4 into cloudfoundry:develop Jul 11, 2026
21 checks passed
@nabramovitz
nabramovitz deleted the strict-templates-5618 branch July 11, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable strictTemplates across frontend packages

2 participants