Skip to content

Analysis: Component Preparation

Comparison of the current arda-frontend-app implementation against the goal across all three parts. Part 1 (legacy cleanup) and Part 2 (utility extraction) are entirely unimplemented — the dead code remains and no shared utilities have been extracted. Part 3 (local development tooling) is substantially complete: the shell script, npm script entry, and README documentation already exist; only the Makefile target and CLAUDE.md update are missing.

Specification vs. Implementation Comparison

Section titled “Specification vs. Implementation Comparison”

Category 1: Significant Gaps (Features Not Implemented)

Section titled “Category 1: Significant Gaps (Features Not Implemented)”

Part 2 — Utility Extraction (all 7 groups)

Section titled “Part 2 — Utility Extraction (all 7 groups)”

None of the proposed utility files exist:

FileStatus
src/lib/api-route-utils.tsdoes not exist
src/lib/storage.tsdoes not exist
src/lib/errors.tsdoes not exist
src/lib/formatters.tsdoes not exist
src/lib/env-spa.tsdoes not exist

The duplicated patterns described in the goal are confirmed present:

  • 43 API route files under src/app/api/arda/ each contain an inline generateGuid function (7 lines) and content-type parsing block (4-5 lines).
  • 9 lookup functions in src/lib/ardaClient.ts (lines 400-831) share near-identical triple-fallback parsing logic differing only by endpoint and field name.
  • 11 inline JWT decode sites across authThunks.ts, tokenRefresh.ts, AuthInit.tsx, and AuthContext.tsx duplicate logic already available in src/lib/jwt.ts:decodeJWTPayload().
  • localStorage JSON access with try/catch wrappers appears in 24+ locations.
  • Error message extraction (instanceof Error ? .message : String(error)) appears in 20+ locations.
  • Date/currency/quantity formatters live in src/components/table/columnPresets.tsx and src/lib/ardaClient.ts — not reusable outside those files.
  • process.env.NEXT_PUBLIC_* comparisons are scattered across 30+ files with no client-side constants module.

ItemTable.tsx and its test remain in the codebase:

  • src/app/items/ItemTable.tsx — 64-line component importing @tanstack/react-table (the only consumer of that dependency).
  • src/tests/itemTable.test.tsx — 78-line test file exercising only ItemTable.
  • @tanstack/react-table at ^8.21.3 remains in package.json dependencies (line 50).

Consumer audit confirms ItemTable is dead code:

FileReference TypeActive Consumer?
src/app/items/page.tsx (line 30)Imports ItemTableAGGrid onlyNo
src/tests/itemTable.test.tsx (line 2)Imports ItemTable for testingNo (test of dead code)
src/tests/items.test.tsx (line 45)jest.mock referencing pathNo (mock entry only)
src/components/table/columnPresets.test.tsx (line 6)Comment referenceNo
src/app/items/itemTableConfig.ts (line 4)Comment referenceNo

No active consumer exists. Safe to remove.

None identified. The goal describes new extractions, not behavioral changes to existing functionality.

Most deliverables already exist in the codebase:

DeliverableStatusLocation
tools/dev-local.shImplemented120-line script, executable
dev:local npm scriptImplementedpackage.json line 8
README.md local dev docsImplementedLines 265-300
dev-local Makefile targetNot implementedMissing from Makefile
CLAUDE.md local dev docsNeeds verificationMay already be documented
  • src/tests/items.test.tsx line 45 contains a jest.mock path referencing ItemTable. After deletion, this mock entry becomes a no-op pointing at a missing module. It should be removed to keep the test clean, though it will not cause a failure.
RequirementPartStatusNotes
Remove ItemTable.tsx1gapFile exists, confirmed dead code
Remove itemTable.test.tsx1gapFile exists, tests dead component
Remove @tanstack/react-table1gapOnly used by ItemTable.tsx
Clean stale jest.mock in items.test.tsx1gapNo-op mock of deleted path
Extract API route utilities (Group A)2gap43 routes with duplicated boilerplate
Refactor lookup functions (Group B)2gap9 near-identical functions
Consolidate JWT decode (Group C)2gap11 inline sites vs existing jwt.ts
Extract storage utilities (Group D)2gap24+ duplicated localStorage patterns
Extract error utilities (Group E)2gap20+ duplicated narrowing patterns
Extract formatters (Group F)2gapCoupled to columnPresets.tsx
Extract env-spa constants (Group G)2gap30+ scattered env checks
tools/dev-local.sh3okAlready implemented
dev:local npm script3okAlready in package.json
README.md local dev docs3okAlready documented
dev-local Makefile target3gapMissing from Makefile
CLAUDE.md local dev docs3verifyMay already exist
CHANGELOG updateallgapRequired for PR

Straightforward deletion with zero risk to active functionality. Removes a dependency and reduces bundle size. Should be the first commit to establish a clean baseline.

Highest effort, highest return. Group A (API route infrastructure) alone eliminates ~510 lines of duplication across 43 files. Groups are independent and can be committed separately, reducing review burden.

Priority 3: Local Development Tooling (Part 3)

Section titled “Priority 3: Local Development Tooling (Part 3)”

Mostly complete. Only the Makefile target and potentially CLAUDE.md update remain. Minimal effort to close.


Copyright: (c) Arda Systems 2025-2026, All rights reserved