Skip to content

Commit ebadcf0

Browse files
committed
Polish native editor interactions and verification
1 parent 1f671c0 commit ebadcf0

39 files changed

Lines changed: 976 additions & 1502 deletions
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
name: Rust WIP refactor plan
3+
description: Structural work to complete in rust-wip before selectively moving domains into rust-stable
4+
---
5+
6+
# Rust WIP refactor plan
7+
8+
## Purpose
9+
10+
`rust-wip` is functionally broad but developed as a fast, exploratory workspace.
11+
Before work is transferred into `rust-stable`, make its ownership boundaries and
12+
module structure match [conventions.md](conventions.md). The stable branch should
13+
then receive small, reviewable domain slices rather than architectural cleanup.
14+
15+
This is a plan, not a license to cherry-pick the existing WIP history. The
16+
current 87 WIP-only commits are archaeological evidence; WIP is the source
17+
snapshot and stable receives deliberate file-level transfers.
18+
19+
## Assessment baseline
20+
21+
On 2026-07-18, `rust-stable` was the merge base of `rust-wip`. The committed
22+
delta was 463 files, +44,043 / -2,642 lines. The largest native additions were
23+
the panel UI (+13,421 lines), Chonsole (+3,729), editing states (+2,999), and
24+
developer console (+1,944).
25+
26+
The backend is already mostly feature-first: commands, models, and tests are
27+
generally co-located under their feature directories. The main exception is the
28+
native UI, which is organized by rendering technology under `panels/editors`.
29+
30+
## Refactors required before stable transfers
31+
32+
### 1. Make feature UI feature-owned
33+
34+
`panels/` must retain only reusable RmlUi infrastructure: host/document
35+
lifecycle, fields, modal primitives, grid, input, and shared theme. Move actual
36+
editor behaviour beside the feature it represents:
37+
38+
```text
39+
objects/ui/{definitions,properties,collision}/
40+
heightmap/ui/
41+
grass/ui/
42+
metal/ui/
43+
textures/ui/
44+
map_settings/ui/
45+
teams/ui/
46+
project/ui/
47+
```
48+
49+
The generic panel registry can remain shared, but each feature must register its
50+
own editor. This is the highest-value refactor: an Objects or Textures transfer
51+
then becomes a coherent domain copy rather than surgery inside a generic folder.
52+
53+
### 2. Remove the state → panel dependency
54+
55+
Editing states currently depend on `panels::ModelShader` for ghost previews,
56+
selection highlights, movement, and rotation. Extract world rendering to
57+
`states` or a neutral renderer module. Map interaction must not depend on the
58+
right-hand panel implementation.
59+
60+
### 3. Shrink the panel coordinator and editor contract
61+
62+
`PanelManager` currently owns document lifecycle, editor lifecycle, actions,
63+
field commits/drags, modal coordination, state synchronisation, and cursor tips.
64+
Keep a small composition point, but extract active-editor lifecycle, modal
65+
coordination, toolbar actions, and field commits into focused components.
66+
67+
Likewise split the broad `Editor` trait into explicit capabilities around
68+
lifecycle/rendering, field hosting, brush/state binding, and optional modal
69+
ownership. Do not introduce a general event bus or UI framework: retain the
70+
explicit update/input order, just give each concern a narrow owner.
71+
72+
### 4. Finish the Objects boundary
73+
74+
Refactor the Objects UI into definitions/catalog/filtering/placement/thumbnails,
75+
properties, and collision submodules. Properties and collision must share
76+
selection projection and object-field mapping rather than duplicate conversion
77+
logic.
78+
79+
At the same time, complete TODO #1 in [todo.md](todo.md): replace generic
80+
JSON-based Area/Feature/Unit object commands with concrete typed commands, and
81+
cache static object-field descriptors. This makes Objects safer and smaller to
82+
review in stable.
83+
84+
### 5. Split project persistence from the Project feature
85+
86+
Extract project paths plus save/load/export registrations into a neutral
87+
project-IO/workspace module. Leave scenario metadata, archive export, reload,
88+
map info, and project-editor functionality in `project/`. This is TODO #16 and
89+
prevents each saving feature from depending on the whole Project feature.
90+
91+
### 6. Split the texture editor by ownership
92+
93+
Move material discovery/parsing into `textures`, separate saved-brush state, and
94+
leave a thin UI composition layer. Texture/material ownership must not be
95+
trapped in one large panel editor before the Textures domain is transferred.
96+
97+
### 7. Establish a shared native RmlUi theme
98+
99+
Centralize common text, color, border, opacity, button, toggle, dropdown, and
100+
tooltip rules. Keep only document-specific layout in panel, Chonsole, and
101+
developer-console stylesheets. This prevents future stable slices from changing
102+
three visual systems for one control correction.
103+
104+
### 8. Separate E2E runner responsibilities
105+
106+
Split the `E2ERun` monolith into engine session lifecycle, input, assertions and
107+
command-log reading, screenshots/artifacts, and reporting. Keep semantic UI
108+
coordinates centralized in `scenarios/geometry.py`; that file already fixes the
109+
previous scattered-coordinate problem.
110+
111+
## Do not rewrite these first
112+
113+
- Chonsole is already sensibly divided into catalog, completion, input, history,
114+
model, and views. Transfer it as one domain after shared RmlUi lifecycle work.
115+
- Developer console has a useful actions/log/metrics/manager/view split. Limit
116+
restructuring to common lifecycle and theme extraction.
117+
- Do not replace the command system wholesale; reconcile only its required WIP
118+
delta against stable.
119+
120+
## Completion criteria
121+
122+
Before the first stable transfer:
123+
124+
1. Feature UI no longer lives in `panels/editors`.
125+
2. `states` no longer imports panel UI/rendering.
126+
3. Project IO is independent of the Project feature.
127+
4. The shared native theme has a single source of truth.
128+
5. The E2E harness and verification ledger identify a feature's tests without
129+
relying on obsolete phase documents.
130+
6. Duplicate model-factory registration fails loudly, as duplicate command
131+
registration already does.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
name: Rust stable transfer plan
3+
description: Order and rules for moving refactored rust-wip domains into rust-stable
4+
---
5+
6+
# Rust stable transfer plan
7+
8+
## Transfer rule
9+
10+
Follow [conventions.md](conventions.md): do not cherry-pick WIP commits. Copy
11+
only the files required for one reviewed domain into `rust-stable`, trim them to
12+
the minimum coherent implementation, test in stable, add a review-queue entry,
13+
and commit only after user authorization.
14+
15+
Every domain transfer includes its production code, focused Rust tests, E2E
16+
scenario changes, and visually reviewed goldens. Goldens are never a final bulk
17+
migration.
18+
19+
## Transfer order
20+
21+
1. **Compatibility spine**
22+
- Port flags and Rust-mode Lua self-disable rules.
23+
- Native/RmlUi lifecycle contract and explicit engine dependency inventory.
24+
- Reload/lifecycle integration coverage.
25+
26+
2. **Native runtime seam**
27+
- Minimal `SBC` integration changes.
28+
- Model-registry changes required by native producers.
29+
- Typed native command submission and command-history projection.
30+
31+
3. **Project IO foundation**
32+
- Extracted project paths plus save/load/export registrations.
33+
- No project editor UI in this slice.
34+
35+
4. **Generic native UI foundation**
36+
- Rml helpers, panel host, common theme, fields, grid, modal primitives, and
37+
input.
38+
- The control gallery is the acceptance test for this foundation.
39+
40+
5. **Chonsole**
41+
- Completion, persistent history, scrolling, mouse input, texture preview,
42+
and reload safety as one self-contained domain.
43+
44+
6. **Developer console and status strip**
45+
- Depends on Rml lifecycle and command history.
46+
- Transfer together so its undo/redo journal has one owner.
47+
48+
7. **World interaction foundation**
49+
- Neutral world renderer, selection, rectangle selection, drag/rotate, and
50+
ghost previews.
51+
52+
8. **Objects**
53+
- Typed commands and descriptors first.
54+
- Definitions/placement, then properties and collision as reviewable
55+
sub-slices.
56+
57+
9. **Terrain UI**
58+
- Heightmap, metal, and grass editors over the existing stable backend.
59+
- Reconcile backend deltas rather than overwrite stable implementations.
60+
61+
10. **Textures, then Map Settings**
62+
- Texture/material/brush ownership first.
63+
- Settings afterwards because optional shading textures depend on it.
64+
65+
11. **Environment**
66+
- Lighting, sky, and water under map-settings ownership.
67+
68+
12. **Teams, project info, and toolbar actions**
69+
- These intentionally come after the commands/models they invoke.
70+
71+
13. **Remaining domains**
72+
- Areas, triggers, variables, and compile/export pieces, each independently
73+
testable and reviewable.
74+
75+
## Per-slice exit criteria
76+
77+
Before a domain enters the review queue:
78+
79+
1. `just check` is green in stable.
80+
2. Feature-local unit/integration tests are green.
81+
3. The relevant native E2E target passes with zero warnings/errors/crashes.
82+
4. Every changed golden has been visually inspected and recorded as
83+
`ai-reviewed`.
84+
5. [verification.md](verification.md) has accurate `DONE`/`VERIFIED` evidence.
85+
6. The review-queue row links the Rust files, replaced Lua code where relevant,
86+
a short in-game test recipe, risks, and CI status.
87+
88+
## Important constraints
89+
90+
- `rust-stable` already contains substantial backend work. Reconcile every
91+
transfer; do not blindly replace a stable directory with its WIP counterpart.
92+
- Lua/RmlUi work is a separate historical product line. Only move Lua changes
93+
needed to prevent ownership collisions in Rust mode.
94+
- Engine changes live outside this repository and need their own explicit
95+
compatibility inventory before a stable cutover.

0 commit comments

Comments
 (0)