Skip to content

refactor: package code organization wave 16 - #2397

Merged
gsxdsm merged 1 commit into
feature/code-organization-wave15from
feature/code-organization-wave16
Jul 22, 2026
Merged

refactor: package code organization wave 16#2397
gsxdsm merged 1 commit into
feature/code-organization-wave15from
feature/code-organization-wave16

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

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

  • @fusion/core typecheck
  • CI merge gate

Stack: #2394this PR#2398

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.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f3c7f68-78dd-4f0a-9b7b-1fd3c249962e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR extracts large core type definitions into dedicated modules, preserves access through types.ts re-exports, redirects project store imports to project-store-ops.js, updates a PostgreSQL test hook import, and refreshes comments and line-count baselines.

Changes

Core type modules

Layer / File(s) Summary
Domain type modules
packages/core/src/types/task-core.ts, packages/core/src/types/task-log.ts, packages/core/src/types/todo-list.ts, packages/core/src/types/board-config.ts, packages/core/src/types/archive-planning.ts
Task, logging, todo, board, archive, mesh, planning, and workflow-related contracts are defined in dedicated modules.
Settings and setup contracts
packages/core/src/types/settings-scope.ts, packages/core/src/types/multiproject-setup.ts, packages/core/src/types/plugin-activation.ts
Settings scopes, configuration helpers, migration/setup shapes, and plugin activation types are added as separate exports.
Barrel export rewiring
packages/core/src/types.ts
Inline definitions are replaced with imports and re-exports from the new type modules.
Store wiring and baselines
packages/core/src/store.ts, packages/core/src/__tests__/postgres/workflow-create.pg.test.ts, packages/core/src/task-store/*, scripts/line-count-baseline.json
Project store implementations and the workflow test hook now import from project-store-ops.js; related comments and recorded line counts are updated.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main refactor: wave 16 package code organization and module extraction.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/code-organization-wave16

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR splits the central core type file into smaller modules. The main changes are:

  • Moves task and log contracts into dedicated modules.
  • Moves board, todo-list, plugin activation, and multi-project setup contracts.
  • Preserves the existing public surface through imports and re-exports.
  • Updates the line-count baseline after shrinking types.ts.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
packages/core/src/types.ts Replaces inline declarations with imports and re-exports from the new type modules.
packages/core/src/types/task-core.ts Contains the extracted task model, claims, branch groups, PR entities, and task detail contracts.
packages/core/src/types/task-log.ts Contains the extracted task step, activity, agent log, attachment, and comment contracts.
packages/core/src/types/board-config.ts Contains board and merge contracts plus column labels, descriptions, and transitions.
packages/core/src/types/todo-list.ts Contains todo-list contracts and the shared-state snapshot version.
packages/core/src/types/plugin-activation.ts Contains plugin activation persistence contracts.
packages/core/src/types/multiproject-setup.ts Contains first-run setup and migration contracts.
scripts/line-count-baseline.json Removes the obsolete baseline entry after types.ts falls below the line limit.

Reviews (2): Last reviewed commit: "refactor: wave16 peels — task-core/task-..." | Re-trigger Greptile

@gsxdsm
gsxdsm changed the base branch from main to feature/code-organization-wave15 July 22, 2026 08:00
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)
@gsxdsm
gsxdsm force-pushed the feature/code-organization-wave16 branch from b2acff3 to 7444771 Compare July 22, 2026 08:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/core/src/types/archive-planning.ts (1)

12-23: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Import already-peeled types from their owning submodules, not the barrel. These focused modules re-import types that this PR just moved out of types.ts via 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: import ActivityEventType, AgentLogEntry, ArchiveAgentLogMode, TaskAttachment, TaskComment, TaskLogEntry, TaskStep from ./task-log.js and MergeDetails, TaskBranchContext, TaskTokenUsage from ./task-core.js instead of ../types.js.
  • packages/core/src/types/settings-scope.ts#L47: import ArchiveAgentLogMode from ./task-log.js and TaskTokenBudget from ./task-core.js directly; keep AgentPromptsConfig from ../types.js only 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

📥 Commits

Reviewing files that changed from the base of the PR and between a9de6b2 and b2acff3.

📒 Files selected for processing (14)
  • packages/core/src/__tests__/postgres/workflow-create.pg.test.ts
  • packages/core/src/store.ts
  • packages/core/src/task-store/project-store-ops.ts
  • packages/core/src/task-store/task-store-helpers.ts
  • packages/core/src/types.ts
  • packages/core/src/types/archive-planning.ts
  • packages/core/src/types/board-config.ts
  • packages/core/src/types/multiproject-setup.ts
  • packages/core/src/types/plugin-activation.ts
  • packages/core/src/types/settings-scope.ts
  • packages/core/src/types/task-core.ts
  • packages/core/src/types/task-log.ts
  • packages/core/src/types/todo-list.ts
  • scripts/line-count-baseline.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 win

Import already-peeled types from their owning submodules, not the barrel. These focused modules re-import types that this PR just moved out of types.ts via 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: import ActivityEventType, AgentLogEntry, ArchiveAgentLogMode, TaskAttachment, TaskComment, TaskLogEntry, TaskStep from ./task-log.js and MergeDetails, TaskBranchContext, TaskTokenUsage from ./task-core.js instead of ../types.js.
  • packages/core/src/types/settings-scope.ts#L47: import ArchiveAgentLogMode from ./task-log.js and TaskTokenBudget from ./task-core.js directly; keep AgentPromptsConfig from ../types.js only 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

📥 Commits

Reviewing files that changed from the base of the PR and between a9de6b2 and b2acff3.

📒 Files selected for processing (14)
  • packages/core/src/__tests__/postgres/workflow-create.pg.test.ts
  • packages/core/src/store.ts
  • packages/core/src/task-store/project-store-ops.ts
  • packages/core/src/task-store/task-store-helpers.ts
  • packages/core/src/types.ts
  • packages/core/src/types/archive-planning.ts
  • packages/core/src/types/board-config.ts
  • packages/core/src/types/multiproject-setup.ts
  • packages/core/src/types/plugin-activation.ts
  • packages/core/src/types/settings-scope.ts
  • packages/core/src/types/task-core.ts
  • packages/core/src/types/task-log.ts
  • packages/core/src/types/todo-list.ts
  • scripts/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.ts

Repository: 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.ts

Repository: 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 say remaining-ops-10.ts, not project-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.

@gsxdsm
gsxdsm merged commit dea0c47 into feature/code-organization-wave15 Jul 22, 2026
2 checks passed
@gsxdsm
gsxdsm deleted the feature/code-organization-wave16 branch July 22, 2026 20:45
gsxdsm added a commit that referenced this pull request Jul 23, 2026
## 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 -->
gsxdsm added a commit that referenced this pull request Jul 26, 2026
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 -->
gsxdsm added a commit that referenced this pull request Aug 3, 2026
## 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**
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.

1 participant