|
1 | | -# Issue #62 Continuation Prompt: Pick Up Where We Left Off |
| 1 | +# Issue #62 Continuation Prompt: Remaining Hardening Scope |
2 | 2 |
|
3 | | -Use this as the handoff prompt for continuing work on: |
| 3 | +Use this as the handoff prompt for any remaining work related to: |
4 | 4 | https://github.com/knightedcodemonkey/develop/issues/62 |
5 | 5 |
|
6 | 6 | ## Prompt |
7 | 7 |
|
8 | | -You are resuming implementation for issue #62 in `@knighted/develop`. |
| 8 | +You are continuing issue #62 in `@knighted/develop` after the main multi-tab |
| 9 | +workspace refactor is already complete. |
9 | 10 |
|
10 | 11 | ### Goal |
11 | 12 |
|
12 | | -Finish the dynamic multi-tab workspace/editor refactor and close remaining |
13 | | -behavior gaps without doing a broad visual redesign. |
| 13 | +Harden the current tab-id-first workspace/editor behavior and close any |
| 14 | +remaining edge-case regressions without broad UI redesign. |
14 | 15 |
|
15 | 16 | ### Current project constraints |
16 | 17 |
|
17 | 18 | - Keep changes localized to `@knighted/develop`. |
18 | 19 | - Preserve CDN-first runtime/fallback behavior. |
19 | | -- Preserve existing lint/build pipeline. |
| 20 | +- Preserve existing lint/build/test pipeline. |
20 | 21 | - Do not add dependencies without asking first. |
21 | 22 | - Prefer focused, minimal diffs over broad rewrites. |
22 | 23 |
|
23 | | -### What is already done |
| 24 | +### What is already complete |
24 | 25 |
|
25 | | -- Dynamic workspace tabs exist with add, rename, remove, and local persistence. |
26 | | -- Entry-role guard exists (entry tab cannot be removed). |
27 | | -- Tab strip was moved to a dedicated full-width row in the editor area. |
28 | | -- Tab visuals were updated toward IDE-like tabs. |
29 | | -- Rename flow was hardened against re-entrant render races. |
30 | | -- Add-tab naming prompt was removed in favor of generated default names. |
31 | | -- Active tab is re-applied on startup to reduce initial-load drift. |
32 | | -- Focus-based kind switching was removed from editor focus handlers. |
33 | | -- `setActiveWorkspaceTabForKind` has been removed. |
34 | | -- Lint/build were passing after the most recent structural change. |
| 26 | +- Dynamic workspace tabs are in place (add/rename/remove) with persistence. |
| 27 | +- Entry-role guard is in place (entry tab cannot be removed). |
| 28 | +- Entry filename contract is enforced (`App.tsx` or `App.js`). |
| 29 | +- One-visible-editor behavior is in place with tab-driven visibility. |
| 30 | +- Full Playwright suite was passing after test cleanup and refactor alignment. |
35 | 31 |
|
36 | | -### Known remaining risk areas |
| 32 | +### Remaining focus areas |
37 | 33 |
|
38 | | -- Residual component/styles lane assumptions still exist in `src/app.js` |
39 | | - (for example cached loaded tab ids and kind-based branches). |
40 | | -- App entry tab selection on initial load has historically been flaky. |
41 | | -- Remove-tab fallback and active-tab/editor sync should stay strictly |
42 | | - tab-id-driven. |
43 | | -- Preview entry/hydration behavior must remain consistent with tab metadata. |
| 34 | +1. Tab-id-first activation hardening |
44 | 35 |
|
45 | | -### Required outcomes for this continuation |
| 36 | +- Keep active tab id as the single source of truth for visible editor content. |
| 37 | +- Prevent hidden-panel interactions or stale branch logic from mutating active tab state. |
46 | 38 |
|
47 | | -1. Make active tab id the single source of truth |
| 39 | +2. Entry and startup determinism |
48 | 40 |
|
49 | | -- Eliminate or isolate remaining lane-coupled activation logic. |
50 | | -- Ensure selecting a tab always controls visible editor content. |
| 41 | +- Verify entry tab restore and initial-load selection remain stable. |
| 42 | +- Keep preview entry resolution aligned with tab metadata (`role: entry`) and documented fallback behavior. |
51 | 43 |
|
52 | | -2. Preserve entry contract and startup determinism |
| 44 | +3. Remove/add/rename coherence |
53 | 45 |
|
54 | | -- Entry tab path should remain `src/components/App.tsx` or `src/components/App.jsx`. |
55 | | -- On first load/restore, App entry tab must be selectable and render correctly. |
| 46 | +- Keep fallback tab selection deterministic after remove. |
| 47 | +- Ensure add and rename flows do not drift name/path/content synchronization. |
56 | 48 |
|
57 | | -3. Keep one-visible-editor behavior stable |
| 49 | +4. Dead migration branch cleanup |
58 | 50 |
|
59 | | -- Only one editor panel should be visible at a time. |
60 | | -- Internal pooling can remain, but hidden editor focus/state must not mutate |
61 | | - active tab. |
| 51 | +- Remove clearly obsolete helper paths or style/DOM hooks that are no longer used. |
| 52 | +- Avoid speculative cleanup outside touched areas. |
62 | 53 |
|
63 | | -4. Keep remove/add/rename flows coherent |
| 54 | +5. Workspace import specifier compatibility |
64 | 55 |
|
65 | | -- Remove fallback must be deterministic and tab-first. |
66 | | -- Rename/add should not produce stale active state or content drift. |
| 56 | +- Support ESM-style runtime specifiers for workspace modules (for example importing |
| 57 | + `./src/components/module.js` from an underlying `.ts`/`.tsx` tab when appropriate). |
| 58 | +- Keep resolution deterministic: exact-match path first, extension-compat fallback second, |
| 59 | + with explicit handling for ambiguous matches. |
67 | 60 |
|
68 | | -5. Clean dead branches introduced during migration |
| 61 | +6. Extension-driven tab kind detection |
69 | 62 |
|
70 | | -- Remove obsolete helpers and stale wiring once replacement paths are active. |
71 | | -- Remove only clearly dead CSS/DOM hooks tied to removed behavior. |
| 63 | +- Ensure new tabs can be created as CSS tabs without relying on active-tab lane assumptions. |
| 64 | +- Add flow should expose explicit editor type selection (`Component`, `Styles`, `Auto`) |
| 65 | + so users can disambiguate toolsets at creation time. |
| 66 | +- Infer tab kind from filename extension/path when adding or renaming tabs |
| 67 | + (for example `.css`, `.less`, `.sass` -> styles tab behavior). |
| 68 | +- `Auto` should infer from extension, while explicit user selection should override inference. |
| 69 | +- Keep editor language, tools, and render pipeline wiring aligned with inferred tab kind. |
72 | 70 |
|
73 | 71 | ### Suggested execution sequence |
74 | 72 |
|
75 | | -1. Audit active-tab flow in `src/app.js`: |
| 73 | +1. Audit high-risk flows in `src/app.js`: |
76 | 74 |
|
77 | 75 | - `setActiveWorkspaceTab` |
78 | 76 | - `loadWorkspaceTabIntoEditor` |
79 | 77 | - remove-tab fallback logic |
80 | | -- startup restore logic |
| 78 | +- startup restore path |
81 | 79 |
|
82 | | -2. Convert remaining kind-branch activation to tab-id-first selection. |
| 80 | +2. Confirm entry resolution consistency with `src/modules/preview-entry-resolver.js`. |
83 | 81 |
|
84 | | -3. Re-test high-risk interactions manually: |
| 82 | +3. Re-test high-risk interactions: |
85 | 83 |
|
86 | | -- initial load with App entry tab |
87 | | -- select between multiple component and style tabs |
| 84 | +- first load/restore with entry tab |
| 85 | +- tab switching across component and style tabs |
88 | 86 | - add tab, rename tab, remove non-entry tab |
89 | | -- switch style modes and verify preview keeps rendering |
| 87 | +- style mode switches with preview render continuity |
| 88 | +- importing workspace modules via `.js` specifiers when source tabs are `.ts`/`.tsx` |
| 89 | +- creating and renaming tabs with style extensions to verify styles-tab behavior |
90 | 90 |
|
91 | 91 | 4. Run validation: |
92 | 92 |
|
93 | 93 | ```bash |
94 | 94 | npm run lint |
95 | 95 | npm run build |
| 96 | +npm run test:e2e |
96 | 97 | ``` |
97 | 98 |
|
98 | | -5. If behavior changed, update docs briefly in `docs/`. |
| 99 | +5. Update docs only if behavior contract changes. |
99 | 100 |
|
100 | 101 | ### Definition of done |
101 | 102 |
|
102 | | -- App entry tab is reliably selectable on initial load. |
103 | | -- No hidden-focus path can override active tab unexpectedly. |
104 | | -- Active tab, visible editor, and persisted content stay in sync. |
105 | | -- Remove/add/rename flows are stable and deterministic. |
106 | | -- Lint/build pass. |
| 103 | +- Active tab id, visible editor, and persisted content remain synchronized. |
| 104 | +- Entry tab is stable on startup and remains renderable. |
| 105 | +- Remove/add/rename flows are deterministic under rapid interaction. |
| 106 | +- Workspace import resolution supports documented ESM-style extension compatibility. |
| 107 | +- New tab behavior correctly recognizes style-file extensions and routes to styles semantics. |
| 108 | +- No stale migration branches remain in touched code. |
| 109 | +- Lint/build/e2e pass. |
0 commit comments