Files
HIPCTF2/.kilo/plans/913-build-fix.md
T

2.8 KiB

Implementation Plan: Fix Job 913 Build Error (missing auth injection in AdminUsersComponent)

1. Root cause

The onToggleRole handler added in the previous turn calls this.auth.currentUser(), this.auth.applyPeerRoleChange(...), and this.auth.publishRoleChange(...) (frontend/src/app/features/admin/admin-users.component.ts:244-247), but AdminUsersComponent never declared an auth field. The component only injects AdminService (admin) and NotificationService (notify). TypeScript build (ng build --configuration production) therefore fails with TS2339: Property 'auth' does not exist on type 'AdminUsersComponent' at lines 244, 246, 247.

The Jest tests passed because they exercise pure modules and admin-players.pure, not the component class — so the missing field was not caught at test time.

2. Required changes (single file)

File: frontend/src/app/features/admin/admin-users.component.ts

  1. Add the import alongside the existing core-service imports (lines 10-11 currently import AdminService and NotificationService):
import { AuthService, AdminUser } from '...';

The AdminUser type can be left on the existing AdminService import line. We must add AuthService and import only the value (not the type) — AuthService is the singleton provided in 'root' by core/services/auth.service.ts.

The accurate edit is:

  • Replace the existing import { AdminService, AdminUser } from '...admin.service'; with two separate imports, or add the new import:
import { AdminService, AdminUser } from '../../core/services/admin.service';
import { AuthService } from '../../core/services/auth.service';
  1. Inject the service alongside the two existing injections (lines ~170-171):
private readonly admin = inject(AdminService);
private readonly notify = inject(NotificationService);
private readonly auth = inject(AuthService);

That is the only change required — the existing onToggleRole body already references this.auth.currentUser, this.auth.applyPeerRoleChange, and this.auth.publishRoleChange, all of which exist on AuthService.

3. Verification

  • npm --workspace frontend run build should pass (no TypeScript errors).
  • npm test should still pass — the existing pure tests (tests/frontend/admin-players.pure.spec.ts, tests/frontend/auth-session-events.spec.ts, tests/backend/admin-players.spec.ts) are unaffected by adding the injection.
  • No public API, route, store, or service signature changes are required.

4. Out of scope

  • No backend changes.
  • No test additions (the build error is a pure TypeScript declaration issue; tests already cover the behaviour).
  • No re-architecture of cross-tab role-change handling — the previous turn's implementation is correct, only the missing field declaration is needed.