Analysis: Component Preparation
Executive Summary
Section titled “Executive Summary”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:
| File | Status |
|---|---|
src/lib/api-route-utils.ts | does not exist |
src/lib/storage.ts | does not exist |
src/lib/errors.ts | does not exist |
src/lib/formatters.ts | does not exist |
src/lib/env-spa.ts | does not exist |
The duplicated patterns described in the goal are confirmed present:
- 43 API route files under
src/app/api/arda/each contain an inlinegenerateGuidfunction (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, andAuthContext.tsxduplicate logic already available insrc/lib/jwt.ts:decodeJWTPayload(). localStorageJSON 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.tsxandsrc/lib/ardaClient.ts— not reusable outside those files. process.env.NEXT_PUBLIC_*comparisons are scattered across 30+ files with no client-side constants module.
Part 1 — Legacy Cleanup
Section titled “Part 1 — Legacy Cleanup”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 onlyItemTable.@tanstack/react-tableat^8.21.3remains inpackage.jsondependencies (line 50).
Consumer audit confirms ItemTable is dead code:
| File | Reference Type | Active Consumer? |
|---|---|---|
src/app/items/page.tsx (line 30) | Imports ItemTableAGGrid only | No |
src/tests/itemTable.test.tsx (line 2) | Imports ItemTable for testing | No (test of dead code) |
src/tests/items.test.tsx (line 45) | jest.mock referencing path | No (mock entry only) |
src/components/table/columnPresets.test.tsx (line 6) | Comment reference | No |
src/app/items/itemTableConfig.ts (line 4) | Comment reference | No |
No active consumer exists. Safe to remove.
Category 2: Behavioral Differences
Section titled “Category 2: Behavioral Differences”None identified. The goal describes new extractions, not behavioral changes to existing functionality.
Category 3: Partially Implemented
Section titled “Category 3: Partially Implemented”Part 3 — Local Development Tooling
Section titled “Part 3 — Local Development Tooling”Most deliverables already exist in the codebase:
| Deliverable | Status | Location |
|---|---|---|
tools/dev-local.sh | Implemented | 120-line script, executable |
dev:local npm script | Implemented | package.json line 8 |
| README.md local dev docs | Implemented | Lines 265-300 |
dev-local Makefile target | Not implemented | Missing from Makefile |
| CLAUDE.md local dev docs | Needs verification | May already be documented |
Category 4: Minor Discrepancies
Section titled “Category 4: Minor Discrepancies”src/tests/items.test.tsxline 45 contains ajest.mockpath referencingItemTable. 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.
Summary Table
Section titled “Summary Table”| Requirement | Part | Status | Notes |
|---|---|---|---|
Remove ItemTable.tsx | 1 | gap | File exists, confirmed dead code |
Remove itemTable.test.tsx | 1 | gap | File exists, tests dead component |
Remove @tanstack/react-table | 1 | gap | Only used by ItemTable.tsx |
Clean stale jest.mock in items.test.tsx | 1 | gap | No-op mock of deleted path |
| Extract API route utilities (Group A) | 2 | gap | 43 routes with duplicated boilerplate |
| Refactor lookup functions (Group B) | 2 | gap | 9 near-identical functions |
| Consolidate JWT decode (Group C) | 2 | gap | 11 inline sites vs existing jwt.ts |
| Extract storage utilities (Group D) | 2 | gap | 24+ duplicated localStorage patterns |
| Extract error utilities (Group E) | 2 | gap | 20+ duplicated narrowing patterns |
| Extract formatters (Group F) | 2 | gap | Coupled to columnPresets.tsx |
| Extract env-spa constants (Group G) | 2 | gap | 30+ scattered env checks |
tools/dev-local.sh | 3 | ok | Already implemented |
dev:local npm script | 3 | ok | Already in package.json |
| README.md local dev docs | 3 | ok | Already documented |
dev-local Makefile target | 3 | gap | Missing from Makefile |
| CLAUDE.md local dev docs | 3 | verify | May already exist |
| CHANGELOG update | all | gap | Required for PR |
Prioritized Recommendations
Section titled “Prioritized Recommendations”Priority 1: Legacy Cleanup (Part 1)
Section titled “Priority 1: Legacy Cleanup (Part 1)”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.
Priority 2: Utility Extraction (Part 2)
Section titled “Priority 2: Utility Extraction (Part 2)”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
Copyright: © Arda Systems 2025-2026, All rights reserved