master production app build is RED: photo-lightbox humanizeDuration(number|null) strictTemplates error #823

Closed
opened 2026-07-24 02:56:13 +00:00 by spikerj · 1 comment
Owner

Symptom

On a clean checkout of master (spikersoft-angular 2137171b), the production app build fails:

NX  libraries/features/photo-gallery/src/lib/photo-lightbox/photo-lightbox.component.html:183:66
    - error TS2345: Argument of type 'number | null' is not assignable to parameter of type 'number'.
183   <span class="step-duration">{{ humanizeDuration(step.processingTimeMs) }}</span>
    Error occurs in the template of component PhotoLightboxComponent.
NX  Running target build for project spikersoft and 78 tasks it depends on failed

nx test feature-photo-gallery fails identically (the vitest builder does the same template type-check). master therefore does not produce a deployable app bundle.

Root cause

humanizeDuration(ms: number) is called with step.processingTimeMs, typed number | null (libraries/domain/photograph/.../photograph.model.ts). PR #560 ("satisfy template/eqeqeq in photo-lightbox metadata guards") wrapped the call in @if ((step.processingTimeMs ?? null) !== null) — which satisfies the eqeqeq ESLint rule but does not narrow the member access for Angular strictTemplates. (Plain != null on a member access doesn't narrow either — that's the pre-#560 state.) So the type error was never actually resolved; #560 only quieted the linter.

Fix

Widen the helper to accept the real type instead of relying on template narrowing:

humanizeDuration(ms: number | null): string {
  if (ms === null) return "";
  ...
}

…and simplify the guard to a clean @if (step.processingTimeMs !== null) (kept for rendering — no empty duration span when timing is absent).

Verified in an isolated master worktree: nx run-many -t lint test -p feature-photo-gallery → lint + 26/26 tests pass; nx build spikersoft --configuration production → bundle generation completes.

Fix PR against master incoming. See also the CI-gate gap that let this merge (separate ticket).

## Symptom On a clean checkout of `master` (spikersoft-angular `2137171b`), the production app build fails: ``` NX libraries/features/photo-gallery/src/lib/photo-lightbox/photo-lightbox.component.html:183:66 - error TS2345: Argument of type 'number | null' is not assignable to parameter of type 'number'. 183 <span class="step-duration">{{ humanizeDuration(step.processingTimeMs) }}</span> Error occurs in the template of component PhotoLightboxComponent. NX Running target build for project spikersoft and 78 tasks it depends on failed ``` `nx test feature-photo-gallery` fails identically (the vitest builder does the same template type-check). `master` therefore does **not** produce a deployable app bundle. ## Root cause `humanizeDuration(ms: number)` is called with `step.processingTimeMs`, typed `number | null` (`libraries/domain/photograph/.../photograph.model.ts`). PR #560 ("satisfy template/eqeqeq in photo-lightbox metadata guards") wrapped the call in `@if ((step.processingTimeMs ?? null) !== null)` — which satisfies the `eqeqeq` ESLint rule but does **not** narrow the member access for Angular strictTemplates. (Plain `!= null` on a member access doesn't narrow either — that's the pre-#560 state.) So the type error was never actually resolved; #560 only quieted the linter. ## Fix Widen the helper to accept the real type instead of relying on template narrowing: ```ts humanizeDuration(ms: number | null): string { if (ms === null) return ""; ... } ``` …and simplify the guard to a clean `@if (step.processingTimeMs !== null)` (kept for rendering — no empty duration span when timing is absent). Verified in an isolated `master` worktree: `nx run-many -t lint test -p feature-photo-gallery` → lint + 26/26 tests pass; `nx build spikersoft --configuration production` → bundle generation completes. Fix PR against `master` incoming. See also the CI-gate gap that let this merge (separate ticket).
Author
Owner

Fixed and verified. spikersoft-angular PR #561 (`e64673a5`, merged to master) widened `humanizeDuration` to accept `number | null`, clearing the strictTemplates error in photo-lightbox.

Verified on master today: the `build` job (the production app build, `nx build spikersoft`) is success on the latest master run (18120, 2026-07-24 18:50Z) and on every master run since #561 landed. Closing.

— Opus 5 Agent

Fixed and verified. spikersoft-angular PR #561 (\`e64673a5\`, merged to master) widened \`humanizeDuration\` to accept \`number | null\`, clearing the strictTemplates error in photo-lightbox. Verified on master today: the \`build\` job (the production app build, \`nx build spikersoft\`) is **success** on the latest master run (18120, 2026-07-24 18:50Z) and on every master run since #561 landed. Closing. — Opus 5 Agent
Sign in to join this conversation.