Skip to content

SPA coverage to 100% lines, and the dependency gates this branch never had - #118

Merged
bgard68 merged 5 commits into
frontendfrom
claude/lotteryapp-prs-security-quality-frze77-frontend
Aug 25, 2026
Merged

SPA coverage to 100% lines, and the dependency gates this branch never had#118
bgard68 merged 5 commits into
frontendfrom
claude/lotteryapp-prs-security-quality-frze77-frontend

Conversation

@bgard68

@bgard68 bgard68 commented Aug 25, 2026

Copy link
Copy Markdown
Owner

The branch had no dependency-vulnerability gate at all

This branch deploys to production, and nothing was checking what it installs:

  • dependency-review existed only on main. For a pull request GitHub resolves the workflow from the base branch, so a PR targeting frontend — the branch carrying the entire npm tree — was reviewed by nothing. Added here, scoped to this branch.
  • Nothing audited the installed npm tree. dependency-review covers what a PR adds; npm audit --audit-level=moderate now covers what is already there, at the same threshold the backend uses.
  • Directory.Build.props was missing the NuGetAudit properties main has. This branch carries src/Lottery.Api and its CI restores, builds and tests it, so a package with a published advisory restored silently here while the same change against main was rejected.
  • npx --yes openapi-typescript resolved and executed latest from the registry on every push and pull request — the one piece of unpinned remote code execution in a repo that otherwise SHA-pins every action and restores from lock files. Pinned to 7.13.0.

Two more consistency fixes

  • ci.yml's Start API ran in Development. Without --no-launch-profile, launchSettings.json forces Development and overrides ASPNETCORE_ENVIRONMENT — so this check proved a different configuration from the identically-named required check on main, while branch protection showed the same green name on both. Also asserts readiness, since the wait loop exits 0 whether or not the API came up.
  • dependabot.yml here was never evaluated (Dependabot reads the default branch only) while declaring nuget coverage that did not exist. Reduced to an empty file with a pointer to main's copy, where the real target-branch: frontend entry now lives.

Coverage

Coverage did not work at all before this: @angular/build's karma builder needs istanbul-lib-instrument, and the lock file carries it only nested under karma-coverage, so --code-coverage failed before instrumenting anything.

Metric Before After
Statements 87.09% 100% (310/310)
Branches 72.85% 98.57% (138/140)
Functions 86.72% 100% (113/113)
Lines 89.51% 100% (248/248)

53 specs → 105. The worst files — api-base-url.ts (11%), viewport.ts (25%), ticket-checker.ts (69.7%), dashboard-store.ts (83.3%) — are all at 100% now.

Two branches are deliberately left uncovered: a ?? [] in ticket-checker.ts that neither call site can reach (both sit inside an @if that already guarantees non-null), and a default parameter on a test double. Both are noted rather than contorted around.

One thing to finish

Making coverage reproducible from a clean clone needs one command, which is not in this PR:

cd lottery-web && npm install --save-dev istanbul-lib-instrument

It was declared here initially, but the regenerated 308 KB lock file could not be pushed through the API-only write path available at the time, and leaving package.json ahead of the lock file would have broken npm ci. Reverted to a consistent pair rather than ship a branch that fails at install.

Verification

npm ci, npm audit (0 vulnerabilities), 105/105 specs, ng build, and check:swa (5 security headers declared, no inline script) all pass against the pushed HEAD, with frontend merged in after #108.

🤖 Generated with Claude Code

bgard68 and others added 5 commits August 24, 2026 13:02
Dependabot bumps init and analyze in separate PRs (#112, #115), but the two
steps must run the same codeql-action version - a mismatched pair ends the
Analyze job in a configuration error. Same consolidation main took in #105.
Supersedes #112 and #115.
package.json declared istanbul-lib-instrument but the matching
package-lock.json update could not be pushed from this environment, and
`npm ci` refuses to install when the two disagree - so CI would have failed at
the install step before running a single spec.

Reverting package.json restores the pair to a consistent state. The 105 specs
do not need the package; only `ng test --code-coverage` does, because
@angular/build's karma builder resolves the instrumenter from the top level and
the lock file carries it only nested under karma-coverage.

To make coverage runnable from a clean clone, run this in lottery-web and
commit both files:

    npm install --save-dev istanbul-lib-instrument
@bgard68
bgard68 merged commit 0b1e73d into frontend Aug 25, 2026
8 checks passed
@bgard68
bgard68 deleted the claude/lotteryapp-prs-security-quality-frze77-frontend branch August 25, 2026 03:01
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.

2 participants