app/islands/step-drafts.ts is now over 1000 lines (1042) and holds several unrelated jobs behind one import. A code review on the issue 7 fix flagged it as a maintainability risk: each new form feature adds to it, and its test file only covers parts of it.
Only app/islands/AutomationForm.tsx and step-drafts.test.ts import it, so a split is cheap to do now.
What's in it today:
| Area | Exports |
|---|---|
| Draft types and conversion | StepDraft and the per-step draft types, mintStepId, stepsToDrafts, draftsToSteps, stepDraftName |
| Trigger gate hoisting | hoistableTriggerBranch, hoistTriggerBranch |
| Tree navigation and editing | ContainerKey, ROOT_CONTAINER, iterateDrafts, locateDraft, countDrafts, subtreeHeight, subtreeStepCount, replaceDraft, removeDraft, appendToContainer, moveWithinContainer, indent and outdent helpers |
| Reference checks and scope | StepIssue, checkStepReferences, namesDefinedInDrafts, collectNamedOutputs |
| Field typing and schema checks | resolveAssertionFieldType, recordPathStatus, operatorsForFieldType, OPERATOR_LABELS |
Proposal:
Split along those lines into an app/islands/step-drafts/ folder, for example:
types.tsconvert.tstree.tsreferences.tsfield-types.ts
Add an index.ts that re-exports everything, so AutomationForm.tsx keeps working unchanged. Split step-drafts.test.ts the same way.
Out of scope:
- No behavior changes. This is a pure move.
- Don't remove the re-exports through
index.ts. That can be a follow-up once the split has settled.
Done when:
- Each new module has one job and stays well under ~400 lines.
AutomationForm.tsximports compile without edits, or with only import-path edits.vp checkis clean andvp testpasses with the same number of tests.
You may want to tweak two things: the module names, and whether AutomationForm.tsx should switch to importing the modules directly instead of relying on the re-exports.
Queued: the loop will work on this version of the issue.
loop:queued cid=bafyreib5n4jtxedguknalyhku7ky3hwbvjg6cl6yz2rx6s7nm4abityvdi