Skip to content

Add fallow static-analysis tooling and remove dead code#1119

Open
busbyk wants to merge 4 commits into
toolingfrom
tooling-fallow
Open

Add fallow static-analysis tooling and remove dead code#1119
busbyk wants to merge 4 commits into
toolingfrom
tooling-fallow

Conversation

@busbyk

@busbyk busbyk commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Sets up fallow (dead-code / duplication / health audit) following its compliance happy-path: fix the real findings, baseline the rest, and gate new regressions in pre-commit + CI. A second commit removes verified dead code.

Stacked on tooling (#1117).

Related Issues

N/A

Key Changes

Setup (commit 1)

  • .fallowrc.json adapted to the single-src/ layout: ignores generated files (payload-types, migrations, admin importMap), shadcn ui exports, namespace-barrel field factories, and config-string-only deps (eslint, sentry OTEL, tailwind, libsql DB infra)
  • Three baselines in fallow-baselines/; fallow + fallow:audit scripts
  • Gating: .husky/pre-commit step + CI fallow job (diff-scoped --changed-since origin/main)
  • Real fixes: 7 src/payload-types@/payload-types imports; removed 6 unused deps (axios, pluralize, prism-react-renderer, @vercel/edge-config, @open-iframe-resizer/core, copyfiles)

Dead-code removal (commit 2)

  • Deleted 10 files verified orphaned via git history; kept getDocumentBySlug + shadcn button-group
  • Re-pointed ADR-012's stale drift binding (already covered by isProviderManager/byProviderRelationship); baselines shrank (dupes 9.4%→8.7%)

How to test

pnpm fallow:audit --ci → no issues. pnpm tsc and pnpm test (417 passing) green. The CI fallow job runs the audit on changed files.

Migration Explanation

N/A — no schema/DB changes.

Future enhancements / Questions

Dead exports/types and circular deps remain baselined (accepted debt) for a future cleanup pass.

busbyk and others added 2 commits June 16, 2026 19:28
Set up fallow (dead-code / duplication / health audit) following the
compliance happy path: fix the real findings, baseline the rest, and
gate regressions in pre-commit + CI.

Real fixes:
- Rewrite 7 `src/payload-types` imports to the `@/payload-types` alias
  (clears fallow's bogus `src` unlisted-dependency finding)
- Remove unused deps: axios, pluralize (+@types/pluralize),
  prism-react-renderer, @vercel/edge-config, @open-iframe-resizer/core,
  copyfiles

.fallowrc.json ignores false positives fallow can't trace statically:
- Generated files (payload-types, migrations, admin importMap route)
- shadcn ui exports + intentional namespace-barrel field factories
- Deps referenced only via config strings (eslint, sentry OTEL,
  tailwindcss-animate) and runtime DB infra (libsql, @libsql/client)

Baselines (fallow-baselines/) capture remaining accepted debt: dead
files/exports/types, circular deps, duplication, health hotspots.

Gating: `pnpm fallow:audit` in .husky/pre-commit and a `fallow` CI job,
both diff-scoped (--changed-since origin/main) so only new regressions
fail.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete 10 files fallow flagged as unused, each verified against git
history as genuinely orphaned (no importers; usages removed in past
refactors):

- exit-preview/GET.ts (x2) — inert duplicates of the sibling route.ts
  (Next App Router serves route.ts; GET.ts is not a route filename)
- hooks/formatSlug.ts — superseded by fields/slug/formatSlug.ts
- endpoints/seed/biographies-all.ts — never-imported seed split; the
  live seed path is biographies.ts (seedStaff)
- utilities/useDebounce.ts — orphaned when @payloadcms/plugin-search
  was removed
- utilities/tenancy/defaultTenantIdFromHeaders.ts — dropped when the
  tenancy model moved off the multi-tenant plugin (ADR 010)
- components/PageRange + components/Pagination — unused; Pagination
  superseded by the shadcn ui/pagination
- utilities/rbac/hasProviderAccess.ts — obsoleted by the events/courses
  split (ADR 012's "separate provider events" path); drift binding
  re-pointed (already covered by isProviderManager/byProviderRelationship)
- fields/crmFields.ts — CRM integration field group removed from
  collections

Kept: utilities/getDocumentBySlug.ts (useful cached slug fetch) and
components/ui/button-group.tsx (vendored shadcn). Both remain accepted
in the shrunk fallow baselines (dupes 9.4%->8.7%).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Preview deployment: https://tooling-fallow.preview.avy-fx.org

busbyk and others added 2 commits June 16, 2026 23:59
Merging main brought 63 commits of new code into scope, so the diff-scoped
audit surfaced pre-existing dupes/dead-code not captured in the baselines
saved on the pre-merge tree. Re-snapshot the three baselines against the
merged codebase. No code findings introduced by this branch; the kept files
(getDocumentBySlug, shadcn button-group) remain the only accepted dead files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@busbyk busbyk changed the base branch from main to tooling June 17, 2026 21:01
@busbyk busbyk marked this pull request as ready for review June 17, 2026 21:03
@busbyk busbyk requested a review from rchlfryn June 17, 2026 21:08

@rchlfryn rchlfryn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool! Thanks for adding

@stevekuznetsov

Copy link
Copy Markdown
Contributor

namespace-barrel field factories

🤯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants