E-1b: Fix 217 TypeScript strict errors to zero (tsc --noEmit clean). - Remove unused vars/imports, fix type mismatches, widen interfaces - TanStack Query v5 isLoading->isPending for mutations - No @ts-ignore or as any introduced E-1ab verification fixes: - Fix audit table name mismatch (security_setting_audit -> security_settings_audit) - Fix DockerContainer TS type (image_name->image, image_tag->tag) to match server - Add 501 for empty binary_path in downloads - Fix ETHOS log format in downloads error path E-1c: Configurable timeouts + path sanitization - Seed 6 operational timeout settings in DB (migration 030) - Wire server to read timeout values from DB at startup - Fallback to hardcoded defaults if DB settings missing - Fix binary_path traversal risk in downloads handler - Add BinaryStoragePath config (REDFLAG_BINARY_STORAGE_PATH) - Log resolved timeout values at startup 163 tests pass (103 server + 60 agent). No regressions. Vite build passes. TypeScript: 0 errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6.3 KiB
6.3 KiB
E-1b TypeScript Strict Compliance
Date: 2026-03-28 Branch: culurien
Summary
Fixed all 217 TypeScript strict errors across aggregator-web/src/ to achieve zero-error npx tsc --noEmit compliance. Vite production build also passes.
Error Breakdown (Before)
| Error Code | Count | Description |
|---|---|---|
| TS6133 | 112 | Unused variables/imports |
| TS2339 | 49 | Property does not exist on type |
| TS2322 | 20 | Type mismatch |
| TS2353 | 3 | Unknown property in object literal |
| TS2345 | 3 | Argument type mismatch |
| TS7006 | 3 | Implicit any parameter |
| TS2367 | 4 | Unintentional type comparison |
| TS18046 | 3 | Value is of type unknown |
| TS2304 | 2 | Cannot find name |
| TS2300 | 2 | Duplicate identifier |
| TS2693 | 2 | Type used as value |
| TS2551 | 2 | Property typo suggestion |
| TS18048 | 2 | Possibly undefined |
| Other | 10 | Various (TS6196, TS6192, TS2865, TS2741, TS2614, TS2554, TS2352, TS2341, TS2312, TS2305) |
Files Changed
Type Definitions
| File | Change |
|---|---|
src/types/index.ts |
Added update_available?: boolean to Agent; added method, enabled to RateLimitConfig; added window_start, window_end to RateLimitUsage; added agent_name?, agent_hostname?, update_available?, current_version?, available_version? to DockerContainer |
src/types/security.ts |
Made EventFilters.date_range.end optional; added required?: boolean to SecuritySetting; widened options to string[] | Array<{ label: string; value: string }> |
API & Library
| File | Change |
|---|---|
src/lib/api.ts |
Removed unused type imports (DockerContainer, DockerImage, DockerUpdateRequest, BulkDockerUpdateRequest); added nonce? to installUpdate params; added nonces? to updateMultipleAgents params; expanded security overview subsystem types with metrics? and checks? |
src/lib/toast-with-logging.ts |
Replaced toast.info/toast.warning (don't exist in react-hot-toast) with custom icon wrappers |
src/lib/client-error-logger.ts |
Removed non-existent ApiError import; made flushOfflineBuffer public (was accessed externally) |
Hooks
| File | Change |
|---|---|
src/hooks/useAgentUpdate.ts |
Removed unused imports; replaced toast.info with toast; added error type guards; added checkingUpdate to return value |
src/hooks/useCommands.ts |
Removed unused import; fixed UseMutationResult return types from void to actual API response types |
src/hooks/useUpdates.ts |
Fixed UseMutationResult return types (same pattern as useCommands) |
src/hooks/useHeartbeat.ts |
Changed interface extends to type = ... & (TS2312); removed unused queryClient; fixed query.state.data access |
src/hooks/useSecuritySettings.ts |
Removed unused imports; removed unused token variable; fixed WebSocket 3-arg call to 2-arg |
src/hooks/useDocker.ts |
Removed unused type imports |
src/hooks/useRateLimits.ts |
Removed unused type imports |
src/hooks/useRegistrationTokens.ts |
Removed unused type imports |
src/hooks/useScanState.ts |
Removed { subsystem } from toast options (not a valid Toast property) |
Components
| File | Change |
|---|---|
src/components/AgentHealth.tsx |
Removed unused useMemo, refetch, getSecurityStatusDisplay |
src/components/AgentStorage.tsx |
Removed unused isError |
src/components/AgentUpdate.tsx |
Removed unused checkingUpdate; replaced toast.info with toast |
src/components/AgentUpdatesEnhanced.tsx |
Removed unused imports; added missing isLoadingLogs state; fixed API method calls |
src/components/AgentUpdatesModal.tsx |
Removed unused data param |
src/components/ChatTimeline.tsx |
Removed 7 unused vars/functions; removed unused Terminal import; widened NarrativeSummary.statusType to include 'pending' | 'info' |
src/components/HistoryTimeline.tsx |
Removed unused useEffect, Clock |
src/components/RelayList.tsx |
Removed unused React; replaced toast.info with toast; fixed error type guard; fixed version undefined |
src/components/SetupCompletionChecker.tsx |
Removed unused isSetupMode state |
src/components/security/SecurityEvents.tsx |
Removed 6 unused imports; fixed loading to isLoading; fixed date_range spread to include required start |
src/components/security/SecurityCategorySection.tsx |
Resolved SecuritySetting naming conflict; removed unused state; added value type annotations |
src/components/security/SecuritySetting.tsx |
Resolved type/value import conflict; removed invalid 'checkbox' comparisons; fixed options mapping |
Pages
| File | Change |
|---|---|
src/pages/Agents.tsx |
Removed 10 unused imports/vars; removed orphaned setCurrentTime interval; fixed heartbeatStatus.until null handling |
src/pages/Docker.tsx |
Removed 15 unused imports/vars; fixed property names (image to image_name, tag to image_tag, container_id to id) |
src/pages/RateLimiting.tsx |
Removed 9 unused imports/vars |
src/pages/SecuritySettings.tsx |
Removed 5 unused imports; fixed Error-to-string conversions; fixed status type mapping; fixed possibly-undefined chains |
src/pages/LiveOperations.tsx |
Removed 8 unused imports; fixed `string |
src/pages/Settings.tsx |
Removed 6 unused imports/vars |
src/pages/settings/AgentManagement.tsx |
Removed 8 unused imports/vars |
src/pages/History.tsx |
Removed unused destructured vars |
src/pages/Setup.tsx |
Added : string type annotation to line parameter |
src/pages/TokenManagement.tsx |
Removed 3 unused imports/vars; fixed never type narrowing on token status |
src/pages/Updates.tsx |
Fixed isLoading to isPending (TanStack Query v5) |
Verification
npx tsc --noEmit → 0 errors (was 217)
vite build → Success (676.66 kB bundle)
Notes
- No
@ts-ignoreoras anycasts were used - No component behavior was changed — type fixes only
toast.info/toast.warningdon't exist in react-hot-toast; replaced withtoast()using custom icons- TanStack Query v5 renamed
isLoadingtoisPendingfor mutations; two occurrences fixed - Several type interfaces were missing fields that the API actually returns; these were added as optional fields