gsxdsm
778292b484
refactor: package code organization wave 19 (self-healing pure peels) ( #3403 )
...
## Summary
Starts **U5** of the package code-organization program after wave 18
(executor peels) landed.
Peels pure free-function clusters out of `self-healing.ts` into
`packages/engine/src/self-healing/` without behavior changes. Public
imports from `./self-healing.js` remain stable via re-exports.
### Peels
| Symbol | New home |
|--------|----------|
| `autoRecoverWorktreeSessionStartFailure` |
`self-healing/auto-recover-worktree-session.ts` |
| `archiveAsGhostBug` | `self-healing/archive-ghost-bug.ts` |
| `hasStepProgress` / work-complete helpers |
`self-healing/step-progress.ts` |
### Line count
- `self-healing.ts`: ~15456 → ~15231 (baseline ratcheted to post-peel
live; main had already drifted past the prior grandfathered ceiling via
organic growth)
- New modules each well under 2,000 lines
## Test plan
- [x] `pnpm --filter @fusion/engine exec tsc --noEmit`
- [x] `self-healing-trait-rekey.test.ts` (autoRecover requeue)
- [x] `self-healing-paused-abort-recovery.test.ts`
- [x] `self-healing-model-unavailable-recovery.test.ts`
- [ ] CI gate
## Follow-ups
U5 Slice B: domain method clusters (startup, in-review, merge-status,
workspace, surfacing) into additional `self-healing/*.ts` modules.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved automatic recovery when worktree sessions fail to start,
including stale or incomplete session data.
* Tasks can be safely requeued while preserving progress, or escalated
after retry limits are reached.
* Improved handling of completed work and failures where task completion
was not recorded.
* Preserved valid task branches during recovery and provided more
reliable fallback requeue behavior.
* Ghost bugs are automatically archived with recovery details and
activity history.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-11 11:29:30 -10:00
gsxdsm
1cf86baa1c
refactor: package code organization wave 18 (executor pure peels) ( #3317 )
...
## Summary
Wave 18 continues the package code-organization program after wave 17
domain folders (U4 Slice A from
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`).
### What changed
Peel **pure, behavior-preserving** helpers out of
`packages/engine/src/executor.ts` into domain modules under
`packages/engine/src/executor/`, with **stable re-exports** from
`executor.ts` so deep imports and `vi.mock("../executor.js")` keep
working.
| New module | Symbols |
|------------|---------|
| `executor/task-done-refusal.ts` | `evaluateTaskDoneRefusal`,
`determineRevisionResetStart`, skip-bypass refusal helper |
| `executor/workflow-feedback-paths.ts` |
`extractReferencedPathsFromWorkflowFeedback`,
`isAlwaysAllowedScopeLeakPath`, `workflowPathMatchesDeclaredScope` |
| `executor/workflow-step-verdict.ts` |
`FUSION_WORKFLOW_STEP_CONVENTIONS_PREAMBLE`, `parseWorkflowStepVerdict`
/ `parseWorkflowStepOutput`, step outcome types |
| `executor/await-input-parse.ts` | `parseAwaitInputSentinel`,
`parseAwaitInputQuestionToolCall` |
| `executor/no-commit-eligibility.ts` | `getNoCommitEligibilityReason`
(+ prompt heuristics) |
`executor.ts` live LOC ~**22817 → ~22427** (first pure-peel batch; more
peels needed to approach the 2k cap).
### Shims
- `old path` `executor.ts` public exports → `new path` `executor/*.ts` →
delete-when consumer deep-imports are re-pointed (not this PR)
### Test plan
- [x] `@fusion/engine` typecheck
- [x] Oracle: task-done refusal, skip-bypass, workflow malformed
verdict, scope-leak allowlist, executor-step-session, executor-prompt
- [x] `vitest --project=engine-core` (merge-gate curated suite)
- [ ] CI merge gate
**Stack:** wave17 (merged) → **this PR**
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Improved recognition of workflow outcomes from structured and
conversational responses.
* Added support for extracting questions from await-input responses and
tool calls.
* Improved workflow feedback handling for referenced files and declared
scope patterns.
* Added clearer guidance for task execution, approvals, verification,
and available tools.
* **Bug Fixes**
* Prevented completion when required review approvals are missing or
revisions remain pending.
* Improved handling of workflows that legitimately require no code
changes.
* Added clearer refusal messages and more reliable revision restarts.
* Sanitized repository paths in Git remediation instructions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-09 15:46:09 -10:00
gsxdsm
616653588c
refactor: package code organization wave 15 ( #2394 )
...
## 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 -->
2026-07-23 00:01:24 -07:00
gsxdsm
ceaf0cc996
refactor: package code organization wave 14 ( #2391 )
...
## Summary
Wave 14 of package code organization (stacks on #2367 / wave 13).
### Peels
| New module | Parent |
|---|---|
| `types/task-review.ts` | task review + PR review surface types |
| `types/documents-artifacts.ts` | documents, artifacts, review-artifact
helpers, goal citations |
| `task-store/workflow-task-create-ops.ts` | rename of `remaining-ops-4`
|
| `task-store/task-mutation-ops.ts` | rename of `remaining-ops-2` |
Public paths stay stable via `types.ts` / `store.ts` re-exports.
### LOC
- `types.ts` ~6264 → ~5871
### Shims
- `types.ts` → peels above (delete-when: consumers import domain
modules)
- `remaining-ops-4` → `workflow-task-create-ops` (rename complete)
- `remaining-ops-2` → `task-mutation-ops` (rename complete)
Only `remaining-ops-1.ts` remains of the numbered ops series.
## Test plan
- [x] `@fusion/core` typecheck
- [x] `review-artifacts` unit tests
- [x] `pnpm check:line-count` (baseline updated)
- [ ] CI merge gate
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **Refactor**
- Split task review, document, artifact, and goal-citation type
definitions into dedicated shared modules.
- Updated task-operation wiring to use the newer task-create/mutation
operation surfaces (no API changes intended).
- **Documentation**
- Corrected inline references and refreshed module headers to match the
current task-operation structure and domain naming.
- **Tests**
- Updated a test import to point to the current duplicate-auto-archive
backend implementation source.
- **Chores**
- Refreshed line-count baseline values to reflect the latest code
layout.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-21 23:33:05 -07:00
gsxdsm
3a7684b90e
refactor: package code organization wave 12 ( #2362 )
...
## Summary
Behavior-preserving package code organization (wave 12), continuing
after wave 11 (#2333 ).
- **Dashboard client API peels** from `app/api/legacy.ts` into focused
modules with stable re-exports:
- `git.ts` — remotes, PR management, terminal sessions, git management
(`withRepoPath` preserved)
- `workspace-files.ts` — file browser + workspace file ops
- `provider-status.ts` — auth/CLI and runtime provider status
- `github-import.ts` / `gitlab-import.ts` — issue/PR import clients
- `run-audit.ts` — run-audit, timeline, org tree, task review
- `task-diff.ts` — task diffs and commit associations
- `agent-import-generation.ts` — agent import catalog + generation
- **Core types peels** from `types.ts`:
- `types/run-audit.ts`
- `types/planner-intervention.ts`
- **Domain rename**: `task-store/remaining-ops-5.ts` →
`task-store/task-id-integrity.ts` (call sites updated)
- **Line-count ratchet**: `legacy.ts` ceiling ~5665 → ~3339; baseline
refreshed
No intentional behavior changes; public import paths via `app/api` /
`@fusion/core` remain stable.
## Test plan
- [x] `@fusion/core` typecheck
- [x] Dashboard `tsconfig.app` typecheck (wave12-related errors cleared;
pre-existing playwright/plugin env noise unchanged vs main)
- [x] ESLint on peeled API modules
- [x] `pnpm check:line-count` (baseline updated)
- [ ] CI: Lint / Typecheck / Build / Gate
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added dashboard client support for Git remotes/PR workflows,
GitHub/GitLab importing, terminals (HTTP/SSE) and PTY sessions,
workspace file browsing/editing/search, and task diff viewing with
file/ZIP download helpers.
- Added new dashboard APIs for planning/onboarding streaming, mission
interview flows, provider/auth status, dev server sessions,
run-audit/timelines & task review, agent import/generation, and AI title
summarization.
- Added backup and settings export/import helpers, plus model
discovery/usage reporting and task steering actions.
- **Refactor**
- Modularized dashboard API clients into focused modules while
preserving the existing integration style.
- **Tests**
- Updated a backend-mode SQLite guidance regression test to exercise the
intended implementations.
- **Chores**
- Refreshed internal line-count baselines.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-21 23:10:08 -07:00
gsxdsm
b07f207b00
FN-8403: extract automation and plugin route registrars
...
Move automation and plugin HTTP handlers out of the routes aggregator into focused domain modules.
- Extract live automation streaming and step-execution helpers
- Register automation, routine, webhook, and plugin handlers through the domain registrar
- Document plugin route ordering and update modular-route baselines
Files changed:
packages/dashboard/src/routes.ts | 2779 ++------------------
packages/dashboard/src/routes/README.md | 3 +-
.../dashboard/src/routes/automation-live-run.ts | 322 +++
.../src/routes/automation-step-execution.ts | 445 ++++
.../src/routes/plugin-bundled-runtimes.ts | 88 +
.../src/routes/register-plugins-automation.ts | 1540 ++++++++++-
scripts/lib/routes-modular-baseline.json | 2 +-
scripts/line-count-baseline.json | 2 +-
8 files changed, 2604 insertions(+), 2577 deletions(-)
Fusion-Task-Id: FN-8403
Fusion-Task-Lineage: 2072d39b-6335-4163-a56a-7d418edc9095
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai >
2026-07-19 17:25:02 -07:00
gsxdsm
48b3656bde
refactor: package code organization wave 11 ( #2333 )
...
## Summary
Wave 11 of package code organization (continues #2328 / wave 10), after
syncing main into the wave10 stack.
### Peels
| New module | Parent |
|---|---|
| `app/api/event-source.ts` | resilient `EventSource` reconnect +
pagehide cleanup |
| `app/api/chat.ts` | chat sessions / rooms / streaming |
| `app/api/projects.ts` | multi-project management client |
| `app/api/agents.ts` | agent CRUD / soul / memory |
| `app/api/workflows.ts` | workflow definition client |
| `app/api/scheduling.ts` | automations + routines |
| `app/api/ai-text.ts` | text refine / import translate / subtasks |
| `app/api/ai-sessions.ts` | AI / planning session client +
`startKeepAlive` |
| `app/api/research.ts` | research + evals client |
| `task-store/branch-and-pr-entities.ts` | rename of `remaining-ops-6` |
Public paths stay stable via `legacy.ts` re-exports (`app/api.ts` →
`legacy`).
### LOC
- `legacy.ts` ~8921 → ~5670
### Shims
- `legacy.ts` → peels above (delete-when: dashboard imports domain
modules)
- `remaining-ops-6` → `branch-and-pr-entities` (rename complete)
## Test plan
- [x] eslint on peeled API modules + legacy
- [x] dashboard app typecheck (`app/api/*` clean)
- [x] core typecheck
- [x] `plugin-setup-api` tests
- [ ] CI merge gate
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Expanded dashboard APIs for agents, AI sessions, chat rooms/sessions,
research runs, projects, workflows, routines/automations, and
scheduling.
* Added AI text refinement/translation, planning title regeneration, and
streamed subtask breakdown with task creation.
* Introduced resilient server-sent-events streaming for chat and other
live updates.
* Added workflow export/import and workflow design support, plus scripts
and workflow configuration controls.
* Added research export and ability to attach research outputs to tasks.
* **Enhancements**
* Missions support clearing an auto-merge override back to project
defaults.
* Subtasks can now include an optional priority when creating tasks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-19 12:16:51 -07:00
gsxdsm
3bf7f92be0
refactor: package code organization wave 10 ( #2328 )
...
## Summary
Wave 10 of package code organization (plan:
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`),
after #2274 .
### Peels
| New module | Parent |
|---|---|
| `types/agents.ts` | `types.ts` (permissions, Agent entity, ratings,
reflections, heartbeat run types) |
| `app/api/missions.ts` | `legacy.ts` (hierarchy, assertions,
validation, autopilot) |
| `app/api/messaging.ts` | `legacy.ts` (mailbox, approvals,
reflections/ratings, budget) |
| `app/api/plugins-and-skills.ts` | `legacy.ts` |
| `app/api/todo.ts` | `legacy.ts` |
| `app/api/insights.ts` | `legacy.ts` |
| `app/api/system-panel.ts` | `legacy.ts` |
| `task-store/workflow-definitions.ts` | rename of `remaining-ops-8` |
Mission interview SSE streams stay in `legacy.ts` until
`createResilientEventSource` is shared.
Public paths stay stable via re-exports.
### LOC
- `types.ts` ~7101 → ~6165
- `legacy.ts` ~10273 → ~8913
### Shims
- `types.ts` → `types/agents.ts` (delete-when: consumers import agents
domain directly)
- `legacy.ts` → peels above (delete-when: dashboard imports domain
modules)
- `remaining-ops-8` → `workflow-definitions` (rename complete)
## Test plan
- [x] `@fusion/core` typecheck
- [x] eslint on peeled dashboard API modules
- [x] `pnpm check:line-count`
- [x] `agent-permissions` + `agent-permission-policy` tests
- [x] `plugin-setup-api` tests
- [ ] CI merge gate
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added typed dashboard API support for missions, milestones/features,
validation loops, and autopilot.
* Added insights browsing and management, including run triggering.
* Added messaging/mailboxes and approvals, plus agent reflections,
ratings, and budget controls.
* Added plugins & skills management and discovery.
* Added todo lists and items with reordering.
* Added system monitoring controls: rebuilds/restarts, logs, and
research finding promotion.
* **Improvements**
* Centralized agent-related type contracts for safer browser
consumption.
* Enhanced legacy API compatibility and improved AI session deletion
error handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-19 09:47:58 -07:00
gsxdsm
ca7bc3e46e
refactor: package code organization wave 9 ( #2274 )
...
## Summary
Wave 9 of package code organization (plan:
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`),
after #2252 .
### Peels
| New module | Parent |
|---|---|
| `app/api/global-and-pi-settings.ts` | `legacy.ts` |
| `app/api/task-content.ts` | `legacy.ts`
(attachments/logs/comments/docs/artifacts) |
| `types/messages.ts` | `types.ts` |
| `merger-diff-volume-gate` helpers | `merger.ts` |
Public paths stay stable via re-exports.
### LOC
- `legacy.ts` ~10561 → ~10269
- `types.ts` ~6998 → ~6937
- `merger.ts` ~11223 → ~11208
## Test plan
- [x] core/engine/dashboard typecheck (app)
- [x] eslint on peeled modules
- [x] api-tasks + memory/agent-log focused tests
- [ ] CI merge gate
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added dashboard API endpoints for global and project-scoped settings,
PI configuration, notification testing, and PI package
install/reinstall.
* Added task content APIs covering attachments, agent logs, session
files, task comments, task documents, artifacts, and project markdown
files.
* Added structured messaging contracts and participant/message
normalization.
* Added diff-volume gate settings resolution and formatted findings
output.
* **Refactor**
* Organized messaging and dashboard API surface into dedicated modules
via re-exports.
* Removed a deprecated verification-output alias.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-18 14:42:59 -07:00
gsxdsm
da7c68c1dc
refactor: package code organization wave 8 ( #2252 )
...
## Summary
Wave 8 of package code organization (plan:
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`),
after #2166 .
### Peels
| New module | Parent |
|---|---|
| `app/api/board-workflows.ts` | `legacy.ts` |
| `app/api/remote.ts` | `legacy.ts` |
| `app/api/memory.ts` | `legacy.ts` |
| `types/docker-nodes.ts` | `types.ts` |
| `task-store/task-store-helpers.ts` | `remaining-ops-10.ts` (rename) |
### CI fix (main unblocker)
FN-8142 requires pi SDK **0.80.8+** (`ModelRuntime`,
`CredentialStore.list`). Floored `@earendil-works/pi-*` to `^0.80.8` so
lockfile resolves past 0.80.6.
Public import paths stay stable via re-exports.
### LOC
- `legacy.ts` ~10975 → ~10561
- `types.ts` ~7349 → ~6928
## Test plan
- [x] core / dashboard typecheck + eslint on peels
- [x] api-tasks (66)
- [x] CI merge gate (Lint / Typecheck / Build / Gate)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added dashboard support for multi-lane board workflows, including
workflow metadata retrieval and task custom-field updates.
* Added dashboard memory client capabilities for reading/writing memory,
managing memory files, compaction/dreaming, insights, auditing, backend
status, and retrieval testing.
* Added remote connectivity controls, including tunnel start/stop,
provider activation, token generation, URL sharing, and QR generation.
* Added Docker node configuration validation plus secure redaction for
sensitive fields in responses.
* **Improvements**
* Consolidated dashboard API exports into dedicated modules and
preserved the legacy API surface via re-exports.
* **Chores**
* Updated related agent dependency versions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-16 22:36:51 -07:00
gsxdsm
06a5fd813d
refactor: package code organization waves 6–7 ( #2166 )
...
## Summary
Waves 6–7 of package code organization (plan:
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`),
after #2148 .
### Wave 6
| New module | Parent |
|---|---|
| `merger-autostash-labels.ts` | `merger.ts` |
| `types/agent-state.ts` | `types.ts` |
| `app/api/tasks-lifecycle.ts` | `legacy.ts` |
| `task-store/task-row-mappers.ts` | `remaining-ops-3.ts` (rename) |
### Wave 7
| New module | Parent |
|---|---|
| `self-healing-optional-step-revision.ts` | `self-healing.ts` |
| `self-healing-path-utils.ts` | `self-healing.ts` |
| `merger-git-parse` (+ `quoteArg`, `getBranchChangedFiles`) |
`merger.ts` |
| `app/api/settings.ts` | `legacy.ts` |
Public import paths stay stable via re-exports.
## Test plan
- [x] engine + dashboard typecheck (incl. app)
- [x] eslint on touched modules
- [x] merger-autostash / parse-porcelain / getBranchChanged / api-tasks
- [ ] CI merge gate
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added a dedicated task lifecycle API client (task promotion, merge,
retry/reset/duplicate, pause/unpause, archive/unarchive, revert, plan
approve/reject) plus branch-group and planner oversight actions.
* Added a settings/config API service (effective task settings, update
check/refresh/install).
* Introduced standardized agent lifecycle states with identity/ephemeral
detection helpers.
* **Bug Fixes**
* Improved autostash label compatibility and NUL-delimited changed-file
detection for branch diffs.
* **Refactor**
* Modularized merger labeling/parsing, self-healing helpers, and
lifecycle/type wiring while keeping behavior consistent.
* **Tests**
* Updated merger verification tests for `git diff -z` output handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-16 15:42:22 -07:00
gsxdsm
9a34862586
refactor: package code organization waves 3–5 ( #2148 )
...
## Summary
Waves 3–5 of package code organization (plan:
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`).
Behavior-preserving peels after #2139 and #2143 .
### Wave 3 — Merger + heartbeat recovery
- **`merger-errors.ts`** — verification/abort error classes
- **`merger-owned-landed.ts`** — ownership classification +
`Fusion-Task-Id` trailer
- **`merger-conflict-resolution.ts`** — conflict classify/auto-resolve
- **`agent-heartbeat-error-recovery.ts`** — durable error-recovery
budget helpers
### Wave 4 — Self-healing + dashboard API
- **`self-healing-constants.ts`** — public timing/budget constants
- **`self-healing-branch.ts`** — `isBranchAheadOfBase`
- **`app/api/client.ts`** — `api` / `ApiRequestError` / `buildApiUrl` /
`proxyApi`
- **`app/api/health.ts`** — health, engine status, updates +
`withProjectId`
### Wave 5 — Types tracking + merger parse + task CRUD
- **`types/task-tracking.ts`** — PR/issue/GitHub/GitLab tracking
contracts
- **`merger-git-parse.ts`** — `parseFailingFilesFromOutput`,
`parsePorcelainZ`, `parseShortstatSummary`
- **`app/api/tasks.ts`** — task list/detail/create/update/move client
surface
- Line-count baselines ratcheted down for `merger.ts`, `types.ts`,
`legacy.ts`
Public import paths stay on parent modules / `legacy.ts` / package
barrels via re-exports.
## Test plan
- [x] core/engine/dashboard typecheck (including `tsconfig.app.json`)
- [x] eslint on touched modules
- [x] `parse-porcelain-z` + merger parseFailing/getBranchChanged tests
- [x] dashboard `api-tasks` + legacy-prinfo/pr-types (69)
- [ ] CI merge gate
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added dashboard API support for task listing/detail, archiving,
creation, review updates, duplicate detection, bulk model updates,
moving tasks, and overlap repair.
- Added health/engine status and refresh/start controls, plus update
checking.
- **Bug Fixes**
- Improved dashboard API handling for non-JSON/HTML responses with
clearer errors, better URL routing for remote nodes, and project-scoped
queries.
- Strengthened automated recovery for heartbeat error/model-unavailable
scenarios and safer merge-conflict classification/auto-resolution.
- **Tests**
- Updated merge-conflict resolution and lifecycle test mocks to match
the updated git command behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-16 00:01:17 -07:00
gsxdsm
8c3758584b
refactor(engine): peel merger glob, test-command, and file-scope satellites ( #2143 )
...
## Summary
Wave 2 of package code organization (follows merged #2139 ): peel
pure/satellite clusters out of `packages/engine/src/merger.ts` while
keeping `merger.js` import paths stable for tests and production.
- **`merger-glob.ts`** — `ConflictType`, `LOCKFILE_PATTERNS`,
`GENERATED_PATTERNS`, `matchGlob`
- **`merger-workspace-test-commands.ts`** — pnpm workspace package
mapping + `inferDefaultTestCommand` / scoped + file-scoped test command
derivation
- **`merger-file-scope.ts`** — `parseDiffStat`, `extractFileScope` /
`matchesScope`, squash file-scope invariant (`FileScopeViolationError`,
assert/enforce with main’s `status` audit semantics and merge-trait
modes)
- Re-exports from `merger.ts`; baseline ratchet for `merger.ts` (~12.5k
→ ~11.8k)
## Test plan
- [x] `pnpm --filter @fusion/engine exec tsc --noEmit`
- [x] eslint on merger + satellites
- [x] `merger-file-scope-invariant.test.ts` (18 tests)
- [x] focused conflict-resolution pattern tests
- [ ] CI merge gate
## Plan
Continues
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`
(U6 merger satellites).
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added file-scope validation for merge operations, with strict and
warning-only enforcement options.
* Added automatic classification of lockfile and generated-file
conflicts.
* Added workspace-aware test selection based on changed packages and
files.
* Added support for inferring test commands across pnpm, Yarn, Bun, and
npm projects.
* **Refactor**
* Organized merge, conflict-resolution, file-scope, and test-inference
functionality into dedicated modules without changing existing public
access paths.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-15 14:44:35 -07:00
gsxdsm
599a509d22
refactor: package code organization (god-file peels, wave 1) ( #2139 )
...
## Summary
First wave of package-internal code organization: split oversized
modules into domain-named files/folders while preserving public import
paths via re-exports, and refresh the line-count ratchet scoreboard.
- **Plan:**
`docs/plans/2026-07-14-001-refactor-package-code-organization-plan.md`
(multi-wave program; this PR lands U1–U4 + first U3/U6 slices)
- **Core types:** peel `types.ts` into
`types/{board,merge-queue,execution-and-ui,merge-policy,workflow-steps}.ts`
with browser-safe Vite alias preserved
- **Core TaskStore:** rename `remaining-ops-9` →
`task-commit-associations` (domain-named, not ordinal dump)
- **Engine executor:** peel pure helpers into
`executor/{browser-probe,requeue-loop,pseudo-pause,workflow-step-failures}.ts`
- **Engine heartbeat:** peel system prompts/procedures into
`agent-heartbeat-prompts.ts`
- **Ratchet:** one-time baseline truth-up + ratchet-down for touched
files
### Deferred to follow-up PRs (plan U5, U7–U9 + remaining waves)
- Self-healing folder split
- Further remaining-ops domain peels
- Dashboard `legacy.ts` / routes / UI monofiles
- CLI extension + TUI peels
## Test plan
- [x] `pnpm --filter @fusion/core exec tsc --noEmit`
- [x] `pnpm --filter @fusion/engine exec tsc --noEmit`
- [x] Focused vitest: `detect-pseudo-pause`,
`executor-browser-verification`, `clear-terminal-workflow-step-failures`
- [x] `node scripts/check-file-line-count.mjs` clean against updated
baseline
- [ ] CI merge gate (lint/typecheck/build/gate)
- [ ] Browser smoke: N/A for this PR (no dashboard UI route changes)
## Residual Review Findings
None. Review autofix applied dual-home wiring for
`clearTerminalWorkflowStepFailures` only.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added configurable heartbeat procedures for task and no-task scenarios
(including patrol-aware rendering).
* Improved agent-browser availability verification with clearer
availability/status reporting.
* Added detection for pseudo-pauses and review-handoff requests.
* Expanded core configuration/contract options for
execution/UI/localization, merges, merge queues, and workflow steps.
* **Bug Fixes**
* Improved handling of transient execute-requeue and workflow-step
retry/cleanup behavior, including better Windows path support.
* Preserved existing public interfaces during internal restructuring.
* **Documentation**
* Added a multi-phase roadmap for future package reorganization.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-15 13:34:30 -07:00
gsxdsm
4178e7d325
FN-7415: Delete stale executor pause quarantine
...
Delete the expired executor pause quarantine and its stale direct-dispatch coverage.
- Remove the obsolete executor-pause test suite after the graph runtime cutover.
- Clear the matching Vitest exclude and quarantine-ledger entry.
- Refresh test audit, timing, line-count, and planning references for the deleted suite.
Files changed:
...7-001-refactor-workflow-runtime-cutover-plan.md | 2 +-
docs/test-value-audit.json | 102 -
.../engine/src/__tests__/executor-pause.test.ts | 3061 --------------------
packages/engine/vitest.config.ts | 5 -
scripts/__tests__/test-velocity-baseline.test.mjs | 2 +-
scripts/lib/test-quarantine.json | 8 +-
scripts/line-count-baseline.json | 1 -
scripts/test-timings.json | 1 -
8 files changed, 3 insertions(+), 3179 deletions(-)
Fusion-Task-Id: FN-7415
Fusion-Task-Lineage: 3d1551c8-1353-47cb-a70f-d88e733a6652
Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai >
2026-07-02 11:38:31 -07:00
gsxdsm
3c66c33cd9
FN-7050: repair route and executor line ceilings
...
Repair the line-count ratchet baseline for focused route and executor drift.
- Add FN-7050 context to the line-count guardrail comments.
- Raise only the routes.ts and executor.ts grandfathered ceilings to match current drift.
- Preserve unrelated baseline entries for separate scoped repairs.
Files changed:
scripts/check-file-line-count.mjs | 3 +++
scripts/line-count-baseline.json | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
Fusion-Task-Id: FN-7050
Fusion-Task-Lineage: 8a57d331-4abf-42bd-a4c9-2f55607a6262
2026-06-25 23:34:08 -07:00
gsxdsm
cc67df9e61
FN-7046: re-ratchet core line-count baselines
...
Repair the scoped core store/type baseline drift without broadening unrelated line-count debt.
- Add the FN-7046 CI note explaining the scoped re-ratchet for store.ts and types.ts.
- Raise only the core store.ts and types.ts grandfathered ceilings to their current generated sizes.
Files changed:
scripts/check-file-line-count.mjs | 3 +++
scripts/line-count-baseline.json | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
Fusion-Task-Id: FN-7046
Fusion-Task-Lineage: 1c64b426-9c51-427d-bacc-e527dffa9d90
2026-06-25 23:34:08 -07:00
gsxdsm
b663eebcb3
FN-7035: split oversized test suites
...
Split oversized ChatView and notifier suites while updating the line-count baseline.
- Move ChatView core contract and interaction coverage into focused sibling test files.
- Move notifier runtime coverage into its own suite and share setup through a test harness.
- Document the line-count guard decision and ratchet baseline entries for existing growth.
Files changed:
.../__tests__/ChatView.core-contracts.test.tsx | 623 ++++++++
.../__tests__/ChatView.core-interactions.test.tsx | 1261 +++++++++++++++
.../components/__tests__/ChatView.core.test.tsx | 1652 +-------------------
.../engine/src/__tests__/notifier.runtime.test.ts | 810 ++++++++++
.../engine/src/__tests__/notifier.test-harness.ts | 71 +
packages/engine/src/__tests__/notifier.test.ts | 847 +---------
scripts/check-file-line-count.mjs | 3 +
scripts/line-count-baseline.json | 12 +-
8 files changed, 2778 insertions(+), 2501 deletions(-)
Fusion-Task-Id: FN-7035
Fusion-Task-Lineage: 14cebb57-925b-41c7-9c8b-472f34b76fe2
2026-06-25 20:50:30 -07:00
gsxdsm
c0958bfd4f
FN-7029: split AI merge prompts and worktree helpers
...
Split the clean-room AI merger into smaller focused modules while preserving its public behavior.
- Extract prompt builders and review verdict parsing into merger-ai-prompts.
- Extract AI merge worktree lifecycle and cleanup helpers into merger-ai-worktree.
- Re-export the extracted APIs from merger-ai and cover prompt/verdict behavior with tests.
- Remove the merger-ai line-count baseline now that the file is under the guardrail.
Files changed:
.../engine/src/__tests__/merger-ai-prompts.test.ts | 86 ++++
packages/engine/src/merger-ai-prompts.ts | 312 ++++++++++++
packages/engine/src/merger-ai-worktree.ts | 287 +++++++++++
packages/engine/src/merger-ai.ts | 555 ++-------------------
scripts/line-count-baseline.json | 1 -
5 files changed, 723 insertions(+), 518 deletions(-)
Fusion-Task-Id: FN-7029
Fusion-Task-Lineage: 59adc31f-7386-4008-b74f-8fb9bbae078a
2026-06-25 20:12:20 -07:00
gsxdsm
e48f80b764
FN-7028: split AgentLogViewer tests by concern
...
Split the large AgentLogViewer suite into focused, line-count-friendly test files.
- Move header, layout, markdown, and rendering coverage into separate test modules.
- Add a shared AgentLogViewer test helper for reusable setup.
- Remove the oversized combined AgentLogViewer test and update the line-count baseline.
Files changed:
.../__tests__/AgentLogViewer.header.test.tsx | 490 +++++
.../__tests__/AgentLogViewer.layout.test.tsx | 367 ++++
.../__tests__/AgentLogViewer.markdown.test.tsx | 797 ++++++++
.../__tests__/AgentLogViewer.rendering.test.tsx | 410 ++++
.../__tests__/AgentLogViewer.test-helpers.ts | 16 +
.../components/__tests__/AgentLogViewer.test.tsx | 2010 --------------------
scripts/line-count-baseline.json | 1 -
7 files changed, 2080 insertions(+), 2011 deletions(-)
Fusion-Task-Id: FN-7028
Fusion-Task-Lineage: 5ef134c7-0969-4b9b-908c-9713daa9d0d2
2026-06-25 19:51:21 -07:00
gsxdsm
0f95f6d1c1
FN-7013: refresh line-count guard baseline
...
Refresh the opt-in line-count guard so current files match the recorded baseline.
- Document why the guard remains outside the default test gate.
- Re-ratchet current line-count violations after organic growth.
- Tighten or prune stale baseline entries and grandfather two long-existing over-cap files.
Files changed:
scripts/check-file-line-count.mjs | 3 +
scripts/line-count-baseline.json | 133 +++++++++++++++++++-------------------
2 files changed, 69 insertions(+), 67 deletions(-)
Fusion-Task-Id: FN-7013
Fusion-Task-Lineage: bd770058-5b42-4d63-a18d-bf46b7b957e0
2026-06-25 16:17:46 -07:00
gsxdsm
8d394cd898
refactor(dashboard): graduate App.tsx off the line-count ratchet baseline
...
App.tsx dropped from 2,729 to 1,636 lines through the module-breakup refactor
(U1-U7), now well under the 2,000-line cap. Remove its grandfathered entry
from scripts/line-count-baseline.json so the file is subject to the cap going
forward and can never regress above 2,000. Scoped change: only the App.tsx
entry is removed; every other ceiling is untouched (a full `--update` would
have re-derived the whole baseline and re-raised ceilings for unrelated
grown files, which AGENTS.md forbids).
U8 (App.tsx module-breakup plan).
2026-06-23 22:15:56 -07:00
gsxdsm
9b440c3b35
FN-6917: re-ratchet line-count baseline
...
Re-ratchet the opt-in line-count audit baseline so current oversized files no longer fail the ceiling check.
- Document that the pnpm test blocker premise is stale because the guard is opt-in.
- Refresh grandfathered line-count ceilings to the current merged tree.
- Add TerminalModal.tsx to the grandfathered oversized-file baseline and drop entries that no longer need it.
Files changed:
scripts/check-file-line-count.mjs | 3 ++
scripts/line-count-baseline.json | 80 +++++++++++++++++++--------------------
2 files changed, 42 insertions(+), 41 deletions(-)
Fusion-Task-Id: FN-6917
Fusion-Task-Lineage: aaa018d8-f1a3-47a5-b63b-f18bac87b910
2026-06-22 19:42:38 -07:00
gsxdsm
af06170a51
FN-6778: add agent artifact registry tools
...
Adds engine and chat tools for registering, discovering, and viewing artifacts with inbox notifications.
- Add fn_artifact_register, fn_artifact_list, and fn_artifact_view tools for heartbeat, executor, and chat sessions.
- Send best-effort dashboard system inbox notifications when artifacts are registered.
- Classify artifact tools for action gating and coordination exemptions, with coverage for executor, heartbeat, permanent agent, and chat flows.
- Document the artifact registry behavior and update package metadata, quarantine ledger, and line-count baseline.
Files changed:
.changeset/fn-6778-artifact-agent-tools.md | 5 +
CONCEPTS.md | 3 +
docs/agents.md | 1 +
packages/core/src/db.ts | 1 +
.../src/__tests__/session-error-recovery.test.ts | 1 +
.../session-persistence-roundtrip.test.ts | 1 +
.../src/__tests__/session-reconnect.test.ts | 1 +
.../src/__tests__/session-resume-history.test.ts | 1 +
packages/dashboard/src/chat.ts | 6 +-
packages/dashboard/src/planning.ts | 4 +
packages/dashboard/src/test/mockCoreEngine.ts | 1 +
.../engine/src/__tests__/agent-action-gate.test.ts | 3 +
.../src/__tests__/agent-artifact-tools.test.ts | 458 +++++++++++++++++++++
.../src/__tests__/executor-step-session.test.ts | 48 +++
.../src/__tests__/gating-classifications.test.ts | 3 +
.../src/__tests__/heartbeat-executor.test.ts | 40 +-
.../src/__tests__/heartbeat-session-prompt.test.ts | 25 +-
.../src/__tests__/permanent-agent-gating.test.ts | 6 +
packages/engine/src/agent-heartbeat.ts | 6 +-
packages/engine/src/agent-tools.ts | 288 ++++++++++++-
packages/engine/src/executor.ts | 25 ++
packages/engine/src/gating-classifications.ts | 7 +
packages/engine/src/index.ts | 9 +
scripts/lib/test-quarantine.json | 8 +-
scripts/line-count-baseline.json | 54 +--
25 files changed, 945 insertions(+), 60 deletions(-)
Fusion-Task-Id: FN-6778
Fusion-Task-Lineage: 7eb4afcb-8140-4f86-9540-eb3b83e64148
2026-06-22 03:34:14 -07:00
gsxdsm
ef4889585f
FN-6779: add artifacts gallery to Documents
...
Adds a Documents-view artifact gallery backed by dashboard artifact registry APIs.
- Add artifact listing and media-serving endpoints with project scoping, validation, and safe artifact path resolution.
- Add client artifact API helpers, SWR caching, and a useArtifacts hook for background-refresh gallery data.
- Extend Documents view with an Artifacts tab, media previews, localized labels, documentation, tests, and a published package changeset.
Files changed:
.changeset/fn-6779-artifacts-gallery.md | 5 +
docs/dashboard-guide.md | 6 +-
packages/dashboard/app/api/legacy.ts | 34 ++++
.../dashboard/app/components/DocumentsView.css | 142 ++++++++++++++++
.../dashboard/app/components/DocumentsView.tsx | 178 ++++++++++++++++++--
.../components/__tests__/DocumentsView.test.tsx | 163 +++++++++++++++++-
.../app/hooks/__tests__/useArtifacts.test.ts | 136 +++++++++++++++
packages/dashboard/app/hooks/useArtifacts.ts | 145 ++++++++++++++++
packages/dashboard/app/utils/swrCache.ts | 1 +
.../src/routes/__tests__/artifacts-routes.test.ts | 182 +++++++++++++++++++++
.../src/routes/register-task-workflow-routes.ts | 125 ++++++++++++++
packages/i18n/locales/en/app.json | 22 ++-
packages/i18n/locales/es/app.json | 27 ++-
packages/i18n/locales/fr/app.json | 27 ++-
packages/i18n/locales/ko/app.json | 27 ++-
packages/i18n/locales/zh-CN/app.json | 27 ++-
packages/i18n/locales/zh-TW/app.json | 27 ++-
scripts/line-count-baseline.json | 16 +-
18 files changed, 1255 insertions(+), 35 deletions(-)
Fusion-Task-Id: FN-6779
Fusion-Task-Lineage: 1d71e4be-4bfc-4706-9cbf-7214f91a79d1
2026-06-21 16:01:07 -07:00
gsxdsm
ef44f6357f
FN-6871: re-ratchet line-count baselines
...
Refresh the line-count audit baseline to match current repository drift.
- Update the grandfathered large-file baseline counts for current source and test files.
- Document that the line-count guard is now an opt-in audit rather than a pretest blocker.
Files changed:
scripts/check-file-line-count.mjs | 3 +++
scripts/line-count-baseline.json | 22 +++++++++++-----------
2 files changed, 14 insertions(+), 11 deletions(-)
Fusion-Task-Id: FN-6871
Fusion-Task-Lineage: d2fcf11e-2959-45a0-9bd1-1dc33b591ccf
2026-06-21 13:25:41 -07:00
gsxdsm
9d31e88eca
FN-6849: refresh line-count guardrail baseline
...
Refresh the line-count guardrail baseline so pretest accepts the current grandfathered source sizes.
- Document the FN-6849 maintenance re-ratchet in the line-count guard script.
- Regenerate the grandfathered line-count baseline for current oversized source and test files.
- Keep the guardrail active while unblocking unrelated pretest runs.
Files changed:
scripts/check-file-line-count.mjs | 7 ++++
scripts/line-count-baseline.json | 74 +++++++++++++++++++--------------------
2 files changed, 44 insertions(+), 37 deletions(-)
Fusion-Task-Id: FN-6849
Fusion-Task-Lineage: 07c04c2a-535c-43b0-9dd5-700ead4e06f0
2026-06-21 13:25:40 -07:00
gsxdsm
2d6ba99caf
chore(ci): add file line-count guardrail to pretest
...
Add a pretest guard that caps new source files at 2,000 lines to stop
god-files from being born, following the existing check-no-* guard pattern.
Existing oversized files (106 of them) are grandfathered via a ratchet
baseline (scripts/line-count-baseline.json): each is pinned to its current
line count and may shrink but never grow. Files refactored under the cap
drop out of the baseline and cannot regress. Generated, lock, locale, and
.d.ts files are out of scope via the source-extension filter.
Wired into pretest and pretest:full; covered by 11 unit tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com >
2026-06-20 23:57:59 -07:00