refactor: package code organization wave 15 - #2394
Conversation
…ore-ops Behavior-preserving package organization after wave 14: - types/settings-scope.ts — global/project settings (~2.2k lines) - types/archive-planning.ts — archive entries, mesh/planning, multi-project types - rename remaining-ops-1 → task-store/project-store-ops.ts (last numbered ops gone) - Ratchet types.ts line-count ceiling (~5872 → ~3074)
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR extracts core, settings, archive-planning, and related contracts from ChangesCore type extraction and wiring
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 reorganizes the core package into smaller domain modules. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (8): Last reviewed commit: "merge: origin/main into feature/code-org..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
packages/core/src/types/settings-scope.ts (1)
75-86: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
GlobalSettingsduplicatesDaemonTokenSettingsinstead of extending it.
daemonToken/daemonPort/daemonHost(with identical JSDoc) are declared both as the standaloneDaemonTokenSettingsinterface and inline inGlobalSettings. ExtendingDaemonTokenSettingswould remove the duplication and keep the two from drifting.♻️ Proposed fix
-export interface GlobalSettings { +export interface GlobalSettings extends DaemonTokenSettings { /** Maximum PostgreSQL server connections for Fusion's embedded database. Applied on the next Fusion restart. */ embeddedPostgresMaxConnections?: number; @@ - /** The daemon authentication token (format: fn_<32 hex chars>). - * Used for authenticating CLI clients to the daemon server. */ - daemonToken?: string; - /** Port for daemon mode server binding. Default: 4040. */ - daemonPort?: number; - /** Host for daemon mode server binding. Default: "127.0.0.1" (localhost only). - * Set to "0.0.0.0" explicitly to expose the API on all interfaces — only do - * this if you understand the implications (terminal/exec endpoints become - * reachable from the LAN even with a bearer token). */ - daemonHost?: string; /** When true, enables automatic settings synchronization between nodes.Also applies to: 705-714
🤖 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/settings-scope.ts` around lines 75 - 86, Update GlobalSettings to extend DaemonTokenSettings and remove its duplicated daemonToken, daemonPort, and daemonHost declarations, preserving the shared JSDoc and existing settings contract through the inherited interface.packages/core/src/types/archive-planning.ts (1)
525-586: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMove the Docker-node import/export block to the top of the file.
This second
import/exportpair (Docker types +validateDockerNodeConfig/sanitizeDockerNodeConfigForResponse) sits ~500 lines into the file instead of alongside the imports at lines 6-23. ES module imports hoist regardless of position, so this is not a functional bug, but it hurts discoverability in a newly-created module.-/** A runtime node that can host project execution (local machine or remote host) */ +import type { + DockerNodeConfig, + DockerNodeVolumeMount, + // ...remaining docker-nodes.js types... +} from "./docker-nodes.js"; +export type { DockerNodeConfig, DockerNodeVolumeMount /* ... */ }; +import { validateDockerNodeConfig, sanitizeDockerNodeConfigForResponse } from "./docker-nodes.js"; +export { validateDockerNodeConfig, sanitizeDockerNodeConfigForResponse }; + +/** A runtime node that can host project execution (local machine or remote host) */ export interface NodeConfig {(and remove the duplicate block from its current mid-file location)
🤖 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 525 - 586, Move the Docker-node type import/export block and the validateDockerNodeConfig/sanitizeDockerNodeConfigForResponse import/export block to the top-level import/export section of the module, alongside the existing imports. Remove the duplicate blocks from their current mid-file location, preserving the same symbols and exports.
🤖 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: Correct the historical filename in the file header comment, replacing
the inaccurate `project-store-ops0.ts` reference with the verified predecessor
filename from the rename history, consistent with the `remaining-ops-*` series
and current `project-store-ops.ts` name.
In `@scripts/line-count-baseline.json`:
- Around line 19-22: Add a line-count baseline entry for
packages/core/src/types/archive-planning.ts in scripts/line-count-baseline.json,
using its current line count (approximately 899). Keep the existing
types/settings-scope.ts entry and ensure the new file is included in
check:line-count monitoring.
---
Nitpick comments:
In `@packages/core/src/types/archive-planning.ts`:
- Around line 525-586: Move the Docker-node type import/export block and the
validateDockerNodeConfig/sanitizeDockerNodeConfigForResponse import/export block
to the top-level import/export section of the module, alongside the existing
imports. Remove the duplicate blocks from their current mid-file location,
preserving the same symbols and exports.
In `@packages/core/src/types/settings-scope.ts`:
- Around line 75-86: Update GlobalSettings to extend DaemonTokenSettings and
remove its duplicated daemonToken, daemonPort, and daemonHost declarations,
preserving the shared JSDoc and existing settings contract through the inherited
interface.
🪄 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: 0bc5f89a-2599-4af2-b149-98383d02fd12
📒 Files selected for processing (8)
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/settings-scope.tsscripts/line-count-baseline.json
| * | ||
| * FNXC:CodeOrganization 2026-07-16-20:00: | ||
| * Renamed from remaining-ops-10.ts (domain: task-store helper ops). | ||
| * Renamed from project-store-ops0.ts (domain: task-store helper ops). |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Correct the historical filename attribution.
This comment now references project-store-ops0.ts, while the supplied rename context identifies the numbered remaining-ops-* series and the current file as project-store-ops.ts. Update it to the actual predecessor filename, or verify the historical name before merging.
🤖 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, Correct the
historical filename in the file header comment, replacing the inaccurate
`project-store-ops0.ts` reference with the verified predecessor filename from
the rename history, consistent with the `remaining-ops-*` series and current
`project-store-ops.ts` name.
| "packages/core/src/store.ts": 2820, | ||
| "packages/core/src/types.ts": 5872, | ||
| "packages/core/src/types.ts": 3074, | ||
| "packages/core/src/types/settings-scope.ts": 2287, | ||
| "packages/dashboard/app/App.tsx": 2136, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Missing baseline entry for the new packages/core/src/types/archive-planning.ts.
types/settings-scope.ts gets a new baseline entry (2287) but the equally new types/archive-planning.ts (~899 lines) has none, leaving it unmonitored by check:line-count. This also doesn't match the PR's claim of updating "line-count baselines" (plural) for the extraction.
"packages/core/src/store.ts": 2820,
"packages/core/src/types.ts": 3074,
+ "packages/core/src/types/archive-planning.ts": 899,
"packages/core/src/types/settings-scope.ts": 2287,
"packages/dashboard/app/App.tsx": 2136,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "packages/core/src/store.ts": 2820, | |
| "packages/core/src/types.ts": 5872, | |
| "packages/core/src/types.ts": 3074, | |
| "packages/core/src/types/settings-scope.ts": 2287, | |
| "packages/dashboard/app/App.tsx": 2136, | |
| "packages/core/src/store.ts": 2820, | |
| "packages/core/src/types.ts": 3074, | |
| "packages/core/src/types/archive-planning.ts": 899, | |
| "packages/core/src/types/settings-scope.ts": 2287, | |
| "packages/dashboard/app/App.tsx": 2136, |
🤖 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 `@scripts/line-count-baseline.json` around lines 19 - 22, Add a line-count
baseline entry for packages/core/src/types/archive-planning.ts in
scripts/line-count-baseline.json, using its current line count (approximately
899). Keep the existing types/settings-scope.ts entry and ensure the new file is
included in check:line-count monitoring.
Resolve packages/core/src/types.ts conflict by keeping the wave15 settings-scope peel re-exports and porting selectedWorkflowModelLanes (#2400) into types/settings-scope.ts ProjectSettings.
## Summary Wave 16 of package code organization (stacks on #2394). ### Peels - `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` ### LOC - `types.ts` ~3074 → ~1473 (under 2000-line hard cap) ## Test plan - [x] `@fusion/core` typecheck - [ ] CI merge gate **Stack:** #2394 → **this PR** → #2398 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **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 -->
After task-core peels, types.ts no longer references signal types inline. Convert leftover import-type lines to type-only re-exports so eslint is clean and the dashboard vite @fusion/core alias still resolves stall/staleness/overseer types.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/types/todo-list.ts (1)
10-11: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMove
SHARED_STATE_SNAPSHOT_VERSIONout of todo-list types.This constant is used by
shared-mesh-state.ts, mesh sync validation/tests, and dashboard mesh routes to version shared mesh snapshots, not todo-list state. Relocate it to the mesh/archive/planning domain types and updatetypes.ts’todo-listre-export section accordingly.🤖 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/todo-list.ts` around lines 10 - 11, Move SHARED_STATE_SNAPSHOT_VERSION from the todo-list types module into the mesh/archive/planning domain types module, then update types.ts so the todo-list re-export no longer owns or exposes it and consumers import it from its new domain location. Preserve the constant’s value and update all references in shared-mesh-state.ts, mesh sync validation/tests, and dashboard mesh routes.
🤖 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.
Nitpick comments:
In `@packages/core/src/types/todo-list.ts`:
- Around line 10-11: Move SHARED_STATE_SNAPSHOT_VERSION from the todo-list types
module into the mesh/archive/planning domain types module, then update types.ts
so the todo-list re-export no longer owns or exposes it and consumers import it
from its new domain location. Preserve the constant’s value and update all
references in shared-mesh-state.ts, mesh sync validation/tests, and dashboard
mesh routes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 06af6a3d-e610-41d8-9e9f-1033edc91596
📒 Files selected for processing (9)
packages/core/src/store.tspackages/core/src/types.tspackages/core/src/types/board-config.tspackages/core/src/types/multiproject-setup.tspackages/core/src/types/plugin-activation.tspackages/core/src/types/task-core.tspackages/core/src/types/task-log.tspackages/core/src/types/todo-list.tsscripts/line-count-baseline.json
💤 Files with no reviewable changes (1)
- scripts/line-count-baseline.json
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/core/src/store.ts
Keep task-core peels for types.ts and port main's TaskWedgeNotificationState / wedgeNotification fields into types/task-core.ts with barrel re-exports.
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 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 sessionstask-store/project-store-ops.ts— rename ofremaining-ops-1(last numbered ops module)LOC
types.ts~5872 → ~3074Test plan
@fusion/coretypecheckStack: this PR → #2397 → #2398
Summary by CodeRabbit