chore(dead-code): phase 2 trim pages shim cascade + packages/common monorepo#6
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐱 Dead Code Cleanup — Phase 2 (radical, ~30 files / -2,586 lines / ~190 KB)
Summary
Continues Phase 1 cleanup. Two unrelated workstreams bundled because they share the same root cause (left-over scaffolding from in-progress refactors that were never finished):
packages/common/monorepo trim — 7 sub-directories with zero project references removed, package pruned to constants-only🅲️ Pages shim cascade
The 4 capital-case
pages/{AutoPipeline,ProjectEdit,ProjectEdit/ScriptDetail,ProjectDetail}/directories were 2-line shims that re-exported the lowercasepages/{auto-pipeline,project-detail,project-edit}/siblings. They existed only to give the router nice PascalCase import paths. Both routers (app/router/page-preload.ts+core/router/page-preload.ts) now use the lowercase canonical paths directly.Deleted (5 files):
src/pages/AutoPipeline/AutoPipelinePage.tsxsrc/pages/ProjectDetail/ProjectDetailPage.tsxsrc/pages/ProjectEdit/ProjectEditPage.tsxsrc/pages/ProjectEdit/ScriptDetailPage.tsxsrc/pages/index.ts(also pointed at shims)Modified:
src/app/router/page-preload.ts— 3 dynamic imports:@/pages/Project{Edit,Detail}/*→@/pages/project-{edit,detail}/*,@/pages/AutoPipeline/*→@/pages/auto-pipeline/*src/core/router/page-preload.ts— same 3 + 1 scriptDetail path🅳️
packages/common/monorepo trimOriginal design (per
docs/adr/0002-frontend-monorepo-ddd.md) was to split the project into a publishable monorepo package withutils/formatters/motion/hooks/components/domain/validationsub-paths. Zero project files actually import any of these — onlyconstantsis referenced (4 sites inMusicTab/SfxTab/audio.entities/VideoExporter). The other 7 sub-directories sat at 192 KB of dead code.Deleted (17 files + 3 empty dirs + 1 README):
packages/common/src/utils/(16 KB)packages/common/src/formatters/(12 KB)packages/common/src/motion/(8 KB)packages/common/src/hooks/(20 KB)packages/common/src/components/ui/{FileUploader,ProgressBar,Modal,ConfirmDialog}.{tsx,module.css}(44 KB)packages/common/src/domain/{character,scene,script,shared,index}.ts(44 KB)packages/common/src/validation/(empty dir)packages/common/eslint-rules/(empty dir)packages/common/tests/(empty dir)packages/common/README-before-after.md(transitional DRY-illustration doc)Modified:
packages/common/src/index.ts— shrunk toexport * from './constants'+ comment explaining the trim and pointing atdocs/adr/0002for original design intentpackages/common/package.json— removed 5 deadexportsentries (./*sub-paths), kept peerDependencies and devDependencies intact for future monorepo resurrection🐛 Two latent bugs exposed (not fixed — out of scope)
Removing the broken
@/pages/ProjectEditPageskip-listing surfaced two pre-existing issues that were hidden behindtestPathIgnorePatternsentries injest.config.cjs. Both are now re-skipped with a more accurate comment so a future "form refactor" PR can pick them up:ProjectEditPage.tsxuseForm API mismatch —const [form] = useForm() as any(line 95) destructures the return value ofuseForm()as a tuple, but the actual export from@/components/ui/ui-componentsisuseRhfForm(react-hook-form) which returns an object. TriggersTypeError: object is not iterable (cannot read property Symbol(Symbol.iterator))at first render. A NOTE comment in the source already flags this as "intentional until form refactor".__tests__/pages/project-{edit,detail}.test.tsximport paths — both used@/pages/ProjectEditPage/@/pages/ProjectDetailPage(no sub-dir, no extension) which never existed as a real module. Fixed to the canonical lowercase paths in this PR so the tests can run, then re-skipped under the new "form refactor" reason.Files re-skipped with new reason in
jest.config.cjs:src/__tests__/pages/project-edit.test.tsxsrc/__tests__/pages/project-detail.test.tsxVerification
npm run lint --quietnpx tsc --noEmitnpm test --runInBand(90 suites)npm run buildDiff
Phase summary
Lesson reinforced
import('@/...')string literals are invisible to staticimportregex sweeps. Phase 1 missed 2 shims (components/business/CompositionStudio+RenderCenter); Phase 2 caught all 4 pages shims because the routers use the same pattern. Thetsc --noEmitsafety net caught the first batch immediately — always run it after everygit rmcycle.testPathIgnorePatternsis a smell audit point — 2 tests in there were broken since v1.x and silently skipped. Dead-code sweeps are a good time to audit ignore lists for stale entries.