chore: cut dead code, single-impl abstractions, hand-rolled stdlib #19

Merged
yuris merged 1 commit from chore/ponytail-cuts into main 2026-07-18 05:43:50 +00:00
Owner

Implements the Dead files & modules, yagni, and stdlib / native findings from the ponytail audit. Pure over-engineering cuts — no behavior change.

Dead files & modules

  • Delete lib/bot/nodes/auth-guard.ts + rewire graph.ts — redundant DB lookup; the wwebjs connector already verifies identity and passes userId into runBotMessage, and the __handled__ short-circuit is still reachable via cleanup-turn-state.
  • Fold ReceiptView into FormUpload (near-duplicate upload UI; PDF-preview dialog folded in), delete receipt-view.tsx; both importers migrated.
  • Inline the one-off SummaryTable into the dashboard page (markup preserved byte-for-byte), delete summary-table.tsx.
  • Delete unused separator.tsx (zero importers).
  • Delete orphaned settings/whatsapp/page.tsx — unreachable (nav only links /settings/profile), its pairing flow is non-functional (pairingToken is never written), and its phone list duplicates PhoneNumbersSection.

yagni

  • Strip unused MCP context plumbing (McpContext/McpScope/CTX_HEADER/discarded _context param). Auth enforcement (static token / JWT / opaque) unchanged.
  • Inline delete-confirm into DetailsActions.
  • Simplify Badge to a plain <span> (drop useRender/mergeProps; variants unchanged).
  • Inline FormCard at its single call site.
  • Co-locate use-media-query into details-panel.tsx.

stdlib / native

  • Rewrite parseCatalog using the existing Zod schema (.strict() + .superRefine for dup slugs); error messages preserved via custom messages (one test regex updated to Zod's Unrecognized key).
  • Swap the 50-line hand-rolled .env parser for native process.loadEnvFile (Node 22; does not override existing env, matching prior semantics — zero new deps).
  • orderItemsWhere → drizzle inArray (callers guard against empty ids).
  • Reuse todayISO() in daily-summary.
  • Reuse OrderStatusEnum in classify-intent.
  • Native Buffer base64url in mcp.ts hashOpaqueToken (verified byte-identical hash output).
  • Drop redundant force-static in store sitemap/robots (output: export forces static).

Verification

  • tsc --noEmit: management + store clean
  • vitest run: 25/25 pass (management); catalog node:test 5/5 pass
  • biome check: clean
  • next build (management): success, 11/11 pages, route list confirms /settings/whatsapp removed

Store next build requires a live catalog API (build-time fetch under output: export) — infra dependency unaffected by these changes; covered by tsc + catalog tests.

Implements the **Dead files & modules**, **yagni**, and **stdlib / native** findings from the ponytail audit. Pure over-engineering cuts — no behavior change. ## Dead files & modules - Delete `lib/bot/nodes/auth-guard.ts` + rewire `graph.ts` — redundant DB lookup; the wwebjs connector already verifies identity and passes `userId` into `runBotMessage`, and the `__handled__` short-circuit is still reachable via `cleanup-turn-state`. - Fold `ReceiptView` into `FormUpload` (near-duplicate upload UI; PDF-preview dialog folded in), delete `receipt-view.tsx`; both importers migrated. - Inline the one-off `SummaryTable` into the dashboard page (markup preserved byte-for-byte), delete `summary-table.tsx`. - Delete unused `separator.tsx` (zero importers). - Delete orphaned `settings/whatsapp/page.tsx` — unreachable (nav only links `/settings/profile`), its pairing flow is non-functional (`pairingToken` is never written), and its phone list duplicates `PhoneNumbersSection`. ## yagni - Strip unused MCP context plumbing (`McpContext`/`McpScope`/`CTX_HEADER`/discarded `_context` param). **Auth enforcement (static token / JWT / opaque) unchanged.** - Inline `delete-confirm` into `DetailsActions`. - Simplify `Badge` to a plain `<span>` (drop `useRender`/`mergeProps`; variants unchanged). - Inline `FormCard` at its single call site. - Co-locate `use-media-query` into `details-panel.tsx`. ## stdlib / native - Rewrite `parseCatalog` using the existing Zod schema (`.strict()` + `.superRefine` for dup slugs); error messages preserved via custom messages (one test regex updated to Zod's `Unrecognized key`). - Swap the 50-line hand-rolled `.env` parser for native `process.loadEnvFile` (Node 22; does not override existing env, matching prior semantics — zero new deps). - `orderItemsWhere` → drizzle `inArray` (callers guard against empty ids). - Reuse `todayISO()` in `daily-summary`. - Reuse `OrderStatusEnum` in `classify-intent`. - Native `Buffer` base64url in `mcp.ts` `hashOpaqueToken` (verified byte-identical hash output). - Drop redundant `force-static` in store `sitemap`/`robots` (`output: export` forces static). ## Verification - `tsc --noEmit`: management + store clean - `vitest run`: 25/25 pass (management); catalog `node:test` 5/5 pass - `biome check`: clean - `next build` (management): success, 11/11 pages, route list confirms `/settings/whatsapp` removed _Store `next build` requires a live catalog API (build-time fetch under `output: export`) — infra dependency unaffected by these changes; covered by tsc + catalog tests._
Dead files & modules:
- Delete bot auth-guard node (redundant DB lookup; connector already
  verifies identity and passes userId) and rewire graph
- Fold ReceiptView into FormUpload (near-duplicate upload UI; PDF preview
  folded in), delete receipt-view.tsx
- Inline one-off SummaryTable into the dashboard page, delete summary-table.tsx
- Delete unused separator.tsx
- Delete orphaned settings/whatsapp page (unreachable; pairingToken is
  never written so the pairing flow is non-functional; phone list
  duplicates PhoneNumbersSection)

yagni:
- Strip unused MCP context plumbing (McpContext/McpScope/CTX_HEADER); auth
  enforcement unchanged
- Inline delete-confirm into DetailsActions
- Simplify Badge to a plain span (drop useRender/mergeProps ceremony)
- Inline FormCard at its call site
- Co-locate use-media-query into details-panel

stdlib / native:
- Rewrite parseCatalog with the existing Zod schema (strict + superRefine)
- Swap hand-rolled .env parser for process.loadEnvFile
- orderItemsWhere -> drizzle inArray
- todayISO() reuse in daily-summary
- OrderStatusEnum reuse in classify-intent
- Buffer base64url in mcp.ts hashOpaqueToken
- Drop redundant force-static in store sitemap/robots (output: export)
yuris merged commit 8d979032d8 into main 2026-07-18 05:43:50 +00:00
yuris deleted branch chore/ponytail-cuts 2026-07-18 05:43:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage!19
No description provided.