refactor: package code organization wave 16 - #2397
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR extracts large core type definitions into dedicated modules, preserves access through ChangesCore type modules
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR splits the central core type file into smaller modules. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "refactor: wave16 peels — task-core/task-..." | Re-trigger Greptile |
Behavior-preserving package organization after wave 15: - types/task-log.ts — steps, activity/agent logs, attachments, comments - types/task-core.ts — Task model, claims, branch groups, PR entities - types/todo-list.ts, board-config.ts, plugin-activation.ts, multiproject-setup.ts - Ratchet types.ts ~3071 → ~1473 (under the 2000-line hard cap)
b2acff3 to
7444771
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/core/src/types/archive-planning.ts (1)
12-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winImport already-peeled types from their owning submodules, not the barrel. These focused modules re-import types that this PR just moved out of
types.tsvia the barrel../types.js, reintroducing a (type-only, so runtime-safe) cycle that works against the extraction goal. Prefer direct submodule imports so the new modules don't depend on the barrel they feed.
packages/core/src/types/archive-planning.ts#L12-L23: importActivityEventType, AgentLogEntry, ArchiveAgentLogMode, TaskAttachment, TaskComment, TaskLogEntry, TaskStepfrom./task-log.jsandMergeDetails, TaskBranchContext, TaskTokenUsagefrom./task-core.jsinstead of../types.js.packages/core/src/types/settings-scope.ts#L47: importArchiveAgentLogModefrom./task-log.jsandTaskTokenBudgetfrom./task-core.jsdirectly; keepAgentPromptsConfigfrom../types.jsonly if it still genuinely lives there.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/types/archive-planning.ts` around lines 12 - 23, Replace barrel imports in packages/core/src/types/archive-planning.ts:12-23 with direct imports from ./task-log.js for ActivityEventType, AgentLogEntry, ArchiveAgentLogMode, TaskAttachment, TaskComment, TaskLogEntry, and TaskStep, and from ./task-core.js for MergeDetails, TaskBranchContext, and TaskTokenUsage. In packages/core/src/types/settings-scope.ts:47, import ArchiveAgentLogMode from ./task-log.js and TaskTokenBudget from ./task-core.js; retain AgentPromptsConfig from ../types.js only if it remains defined there.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/task-store/task-store-helpers.ts`:
- Line 10: Update the module history note in task-store-helpers.ts to reference
remaining-ops-10.ts instead of project-store-ops0.ts, leaving the rest of the
header unchanged.
---
Nitpick comments:
In `@packages/core/src/types/archive-planning.ts`:
- Around line 12-23: Replace barrel imports in
packages/core/src/types/archive-planning.ts:12-23 with direct imports from
./task-log.js for ActivityEventType, AgentLogEntry, ArchiveAgentLogMode,
TaskAttachment, TaskComment, TaskLogEntry, and TaskStep, and from ./task-core.js
for MergeDetails, TaskBranchContext, and TaskTokenUsage. In
packages/core/src/types/settings-scope.ts:47, import ArchiveAgentLogMode from
./task-log.js and TaskTokenBudget from ./task-core.js; retain AgentPromptsConfig
from ../types.js only if it remains defined there.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: be0eba76-b3c9-47cc-a2a4-0252cca055c1
📒 Files selected for processing (14)
packages/core/src/__tests__/postgres/workflow-create.pg.test.tspackages/core/src/store.tspackages/core/src/task-store/project-store-ops.tspackages/core/src/task-store/task-store-helpers.tspackages/core/src/types.tspackages/core/src/types/archive-planning.tspackages/core/src/types/board-config.tspackages/core/src/types/multiproject-setup.tspackages/core/src/types/plugin-activation.tspackages/core/src/types/settings-scope.tspackages/core/src/types/task-core.tspackages/core/src/types/task-log.tspackages/core/src/types/todo-list.tsscripts/line-count-baseline.json
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/core/src/types/archive-planning.ts (1)
12-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winImport already-peeled types from their owning submodules, not the barrel. These focused modules re-import types that this PR just moved out of
types.tsvia the barrel../types.js, reintroducing a (type-only, so runtime-safe) cycle that works against the extraction goal. Prefer direct submodule imports so the new modules don't depend on the barrel they feed.
packages/core/src/types/archive-planning.ts#L12-L23: importActivityEventType, AgentLogEntry, ArchiveAgentLogMode, TaskAttachment, TaskComment, TaskLogEntry, TaskStepfrom./task-log.jsandMergeDetails, TaskBranchContext, TaskTokenUsagefrom./task-core.jsinstead of../types.js.packages/core/src/types/settings-scope.ts#L47: importArchiveAgentLogModefrom./task-log.jsandTaskTokenBudgetfrom./task-core.jsdirectly; keepAgentPromptsConfigfrom../types.jsonly if it still genuinely lives there.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/types/archive-planning.ts` around lines 12 - 23, Replace barrel imports in packages/core/src/types/archive-planning.ts:12-23 with direct imports from ./task-log.js for ActivityEventType, AgentLogEntry, ArchiveAgentLogMode, TaskAttachment, TaskComment, TaskLogEntry, and TaskStep, and from ./task-core.js for MergeDetails, TaskBranchContext, and TaskTokenUsage. In packages/core/src/types/settings-scope.ts:47, import ArchiveAgentLogMode from ./task-log.js and TaskTokenBudget from ./task-core.js; retain AgentPromptsConfig from ../types.js only if it remains defined there.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/task-store/task-store-helpers.ts`:
- Line 10: Update the module history note in task-store-helpers.ts to reference
remaining-ops-10.ts instead of project-store-ops0.ts, leaving the rest of the
header unchanged.
---
Nitpick comments:
In `@packages/core/src/types/archive-planning.ts`:
- Around line 12-23: Replace barrel imports in
packages/core/src/types/archive-planning.ts:12-23 with direct imports from
./task-log.js for ActivityEventType, AgentLogEntry, ArchiveAgentLogMode,
TaskAttachment, TaskComment, TaskLogEntry, and TaskStep, and from ./task-core.js
for MergeDetails, TaskBranchContext, and TaskTokenUsage. In
packages/core/src/types/settings-scope.ts:47, import ArchiveAgentLogMode from
./task-log.js and TaskTokenBudget from ./task-core.js; retain AgentPromptsConfig
from ../types.js only if it remains defined there.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: be0eba76-b3c9-47cc-a2a4-0252cca055c1
📒 Files selected for processing (14)
packages/core/src/__tests__/postgres/workflow-create.pg.test.tspackages/core/src/store.tspackages/core/src/task-store/project-store-ops.tspackages/core/src/task-store/task-store-helpers.tspackages/core/src/types.tspackages/core/src/types/archive-planning.tspackages/core/src/types/board-config.tspackages/core/src/types/multiproject-setup.tspackages/core/src/types/plugin-activation.tspackages/core/src/types/settings-scope.tspackages/core/src/types/task-core.tspackages/core/src/types/task-log.tspackages/core/src/types/todo-list.tsscripts/line-count-baseline.json
🛑 Comments failed to post (1)
packages/core/src/task-store/task-store-helpers.ts (1)
10-10: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
sed -n '1,40p' packages/core/src/task-store/task-store-helpers.tsRepository: Runfusion/Fusion
Length of output: 2382
🏁 Script executed:
rg -n "project-store-ops0|remaining-ops-10|project-store-ops" packages/core/src/task-store packages/core/src/store.tsRepository: Runfusion/Fusion
Length of output: 896
🏁 Script executed:
git ls-files 'packages/core/src/task-store/*' | sed -n '1,120p'Repository: Runfusion/Fusion
Length of output: 3435
🏁 Script executed:
git log --follow --name-status --format='%H %s' -- packages/core/src/task-store/task-store-helpers.ts | sed -n '1,120p'Repository: Runfusion/Fusion
Length of output: 969
Correct the module history note
packages/core/src/task-store/task-store-helpers.ts:10— the header should sayremaining-ops-10.ts, notproject-store-ops0.ts.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/task-store/task-store-helpers.ts` at line 10, Update the module history note in task-store-helpers.ts to reference remaining-ops-10.ts instead of project-store-ops0.ts, leaving the rest of the header unchanged.
## Summary Wave 15 of package code organization. ### Peels - `types/settings-scope.ts` — global/project settings (~2.2k lines) - `types/archive-planning.ts` — archive, mesh/multi-project, planning sessions - `task-store/project-store-ops.ts` — rename of `remaining-ops-1` (last numbered ops module) ### LOC - `types.ts` ~5872 → ~3074 ## Test plan - [x] `@fusion/core` typecheck - [ ] CI merge gate **Stack:** this PR → #2397 → #2398 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Reorganized and expanded the core public type surface into dedicated modules for settings, archive/planning, board, tasks, todo lists, plugin activation, and multi-project setup. * Improved the browser-safe type exports to keep the public contracts consistent. * Updated internal project-level operation wiring to use the correct project implementations. * **Bug Fixes** * Fixed a workflow creation test hook to inject the correct pre-insert behavior for workflow-definition collision/allocator scenarios. * **Chores** * Refreshed internal headers and updated line-count baselines. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Wave 16 of package code organization (stacks on #2394). - `types/task-log.ts`, `types/task-core.ts` — task model + logs - `types/todo-list.ts`, `types/board-config.ts`, `types/plugin-activation.ts`, `types/multiproject-setup.ts` - `types.ts` ~3074 → ~1473 (under 2000-line hard cap) - [x] `@fusion/core` typecheck - [ ] CI merge gate **Stack:** #2394 → **this PR** → #2398 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **Refactor** * Reorganized core task, workflow, settings, board, project, and activity type definitions into dedicated modules. * Consolidated project-store operation wiring without changing functionality. * Improved maintainability of task logs, todo lists, plugin activation, and multi-project setup contracts. * **Documentation** * Updated internal metadata and naming references to reflect the reorganized modules. * **Tests** * Updated PostgreSQL workflow-definition tests to use the corresponding testing hook; existing coverage and behavior remain unchanged. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## Summary Wave 17 organizes Fusion into **domain folders** (stacks on #2397). ### Layout - **core/types/** — board, task, agents, settings, merge, workflow, mesh, … - **core/src/** — agents, ai, async-stores, workflows, tasks, config, db, … - **dashboard/app/api/** — client, tasks, agents, git, missions, planning, … - **engine/src/** — agents, auth, execution, merge, missions, overseer, worktree, … Root keepers retained for large entrypoints (`store.ts`, `executor.ts`, `merger.ts`, …). Public barrels (`@fusion/core`, `@fusion/engine`, `app/api.ts` → legacy) stay stable. ## Test plan - [x] `@fusion/core` typecheck - [x] `@fusion/engine` typecheck (pre-existing playwright-core noise only) - [ ] CI merge gate **Stack:** #2394 → #2397 → **this PR**
Summary
Wave 16 of package code organization (stacks on #2394).
Peels
types/task-log.ts,types/task-core.ts— task model + logstypes/todo-list.ts,types/board-config.ts,types/plugin-activation.ts,types/multiproject-setup.tsLOC
types.ts~3074 → ~1473 (under 2000-line hard cap)Test plan
@fusion/coretypecheckStack: #2394 → this PR → #2398
Summary by CodeRabbit
Refactor
Documentation
Tests