Formax Surface Reset Workflow
Goal
Use this skill when changing REPL clear/reset/resume behavior or any transcript surface transition that can remount Static.
Read First
docs/contracts/transcript-surface-contract.mddocs/runbooks/repl-surface-debugging.mddocs/contracts/invariants.mdwhen ownership or sequencing is unclear
These docs are canonical. If stable surface behavior changes, update them before or with code.
Code Map
- Reset helpers / queue owner:
replaceTranscriptqueueTranscriptSurfaceReplaceresetTranscriptSurfacequeueTranscriptSurfaceResetsurfaceOpQueueRef
- High-risk flows:
packages/core/src/features/repl/controller/ui/packages/core/src/features/repl/controller/session/packages/core/src/features/repl/useReplController.tspackages/core/src/screens/repl/packages/core/src/runtime/bootstrap/runLegacyCli.tsx
- Call sites to watch:
onClearTerminalclearTerminalresetInkStaticOutputForStdouttranscriptSeqremount behavior inReplTranscript/ExpandedReplTranscript
Trigger Conditions
Use this skill whenever the change touches any of:
/resume,/clear, compact boundary transitions- Ctrl+O / Ctrl+E transcript view switches
onClearTerminal,clearTerminal, orresetInkStaticOutputForStdoutreplaceTranscript,queueTranscriptSurfaceReplace,resetTranscriptSurface,queueTranscriptSurfaceReset, orsurfaceOpQueueRef- files under
packages/core/src/features/repl/controller/ui/,packages/core/src/features/repl/controller/session/,packages/core/src/features/repl/useReplController.ts,packages/core/src/screens/repl/, orpackages/core/src/runtime/bootstrap/runLegacyCli.tsx
Minimal Workflow
- Identify the exact path (
/resume,/clear, Ctrl+O / Ctrl+E, compact boundary, etc.). - Route it through
replaceTranscript/resetTranscriptSurfaceinstead of local clear / remount sequencing. - Treat reset as one transaction, not scattered side effects.
- Add or extend regression tests for ordering and surface reset ownership.
- Run the minimum regression set below and at least one real surface smoke path.
Minimum Regression
bun run test -- packages/core/src/features/repl/controller/ui/surfaceReset.test.tsbun run test -- packages/core/src/features/repl/useReplController.test.tsx -t "resume|clear|compact"bun run test -- packages/core/src/screens/repl/surfaceSmoke.test.tsxbun run type-check- If change touches compact / expanded toggles broadly:
bun run test:surface-screen-model
Guardrails
- Keep one surface owner; do not add a second independent clear / remount path.
- Do not stack
replInstance.clear()and ANSI clear in legacy paths unless ownership is explicit and serialized. - Do not accept a Vitest-only fix without running a real surface smoke path.
References
docs/pitfalls/summary.mdsections covering/clear, compact + Ctrl+O, and resume black-screen regressionsdocs/pitfalls/repl-transcript-surface-handoff-pitfall.mddocs/pitfalls/repl-transcript-static-rootcause.md