Lutra/docs/target-app-parity.md
danny 053441d066 M2.5: symbol index and go-to commands
crates/index: walks the project with the search/VFS rules (vendor as
library), parses .php files from tree-sitter outlines on a worker pool
off the engine lock, updates incrementally from disk and buffers through
an updater thread, caps at 200,000 files, and answers fuzzy file, class
and symbol queries (nucleo-matcher, MPL-2.0 as a separate crate).

Engine: index.status, goto.file, goto.class, goto.symbol; events
indexProgress and indexReady drained by the pump; the index starts on
project.open and is cancelled on close. Tests: unit, incremental,
property (random queries and sources), engine and TCP control tests,
release timing on a generated 20k-file project (3.9-4.2 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 12:53:33 +02:00

85 lines
16 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Target-app parity
> **Status:** M1 done (text buffer, VFS, engine workspace, project tree, tabs and a plain-text editor, recovery, palette, settings and themes in the app), no PHP feature ships · **Last updated:** 2026-10-17 · **Target:** PhpStorm 2026.x
## How this is measured
Each feature area gets a weight (how much a typical PHP developer uses it) and a score (how much of the documented behaviour Lutra has, judged by behaviour, not by menu items). The headline depth is the weighted sum. Every score is marked measured or estimated and must point to evidence (tests, commands, screenshots of Lutra). Behaviour references come from public PhpStorm documentation only, noted with URLs in `plan/phpstorm/`.
Hours are the estimated agent wall-clock hours for one agent to reach behaviour parity in the area, from zero. They are first estimates made at the end of M0 and are recalibrated after each milestone from merged-commit timestamps.
## Feature areas
| Area | Weight | Score | Missing | Hours (one agent) | Evidence |
|---|---:|---:|---|---:|---|
| Editor core | 12 | 9% (est.) | syntax highlighting (M2), code folding, soft wrap and other editor settings, preview tab, pinned/split/reordered tabs, close others/all, reopen closed tab, tab limit, conflict UI for files changed on disk, autosave, local history, encodings other than UTF-8, large-file mode, column selection and multi-caret checked against the docs; recovery journal not yet checked in the running app (gaming mode) | ~106 (est.) | M2.1: `crates/syntax` parses PHP with tree-sitter (incremental reparse from `lutra_text` edits) and computes folding ranges (brace blocks, arrays, comments, heredocs, `use` runs); library only, nothing visible in the editor yet, so the score is unchanged. Tests: outline/folding snapshots for five PHP 8.3 fixtures, proptests (random bytes and token soups never panic, reparse equals a fresh parse, undo round trip). 1 MB parse 364–553 ms, reparse after one keystroke 7–11 ms (release, measured, machine busy). M1.13: opening a file that is already open switches to its tab (`bufferFocused`; engine test, Vitest, control-channel test; live check pending (gaming mode)); files in folders the tree never expanded still reload or report changes on disk, because the parent directory of every open buffer stays watched (engine tests). M1.7: crash-recovery journal (`crates/engine/src/journal.rs`, `cmd/recovery.rs`): dirty buffers are written atomically to `<data_dir>/recovery/<project-id>/` about 1 s after the last edit (at least every 2 s while typing), never per keystroke; removed on save, close and discard; `recoveryAvailable` after `project.open`, `recovery.list/restore/discard`; restored buffers are dirty and keep line ending and BOM; corrupt entries are moved aside with a warning. Restore dialog (`ui/src/components/recovery/`: Restore all / selected / Discard, time, changed-on-disk hint). Tests: engine dropped mid-edit and a new engine restores the exact CRLF + BOM text, corrupt entries, removal paths, a property test of random edit sequences → crash → restore equals the buffer (`crates/engine/tests/recovery.rs`, 10 tests), the same flow headless over the control channel (`crates/control/tests/recovery.rs`), 10 Vitest tests for the dialog. 1 MiB entry write: 8.5 ms median (release, measured). Graded against `plan/phpstorm/04-recovery.md`. M1.6: tabs and a CodeMirror 6 editor in the app (`ui/src/components/editor/`, `ui/src/stores/editor.ts`): open from the project tree or engine events, activate, close by button, middle click or `Mod+W`, dirty dot, Save / Don't Save / Cancel on closing a dirty tab, `Mod+S` / `Mod+Alt+S` from engine command specs, non-blocking notice for a dirty file changed or deleted on disk; local edits go to `buffer.edit` with version-based resync, CRLF files keep `\r\n`; undo/redo, multiple selections, search and bracket matching from CodeMirror's basic setup. Vitest: a burst of 400 keystrokes with stale versions and remote edits loses none, a CRLF burst with deletions converges, store and component tests against a fake engine (`ui/tests/editor/`, 22 tests). Checked in the app on Windows 11 with `--control` and `ui.screenshot`: typing via the UI and via `buffer.edit`, save to disk, close question, middle click, disk-change notice. 1 MB file (16,385 lines): engine `file.open` 80 ms over the control channel (debug build, measured), editor state 1–6 ms and first rendered view 4–11 ms in Chromium (measured), ≈ 90 ms in total (estimated, budget 150 ms). Graded against `plan/phpstorm/03-editor-tabs.md`. `crates/text`: rope buffer, positions, edits (M1.1, unit tests + proptests). M1.3: engine buffers with versions and dirty state, `file.open`, `buffer.get`, `buffer.edit` (UTF-16 change sets, `stale_version`), `file.save`, `file.saveAll`, `buffer.close` with unsaved-changes guard, line ending and BOM kept on save, clean buffers reload on external change; 14 integration tests on temp dirs (`crates/engine/tests/workspace.rs`) |
| Project view, VFS | 6 | 8% (est.) | views list (project / scopes), toolbar (Select Opened File, Expand/Collapse All), sort and display options, show/hide excluded, distinct icons for library and excluded folders, file colours, speed search, preview, file operations | ~37 (est.) | `lutra-vfs` (M1.2): lazy sorted listing, ignore rules (.gitignore, .ignore, info/exclude, global excludes, Lutra defaults), native file watching via `notify` with a polling fallback, capped UTF-8 reads, atomic writes; 34 tests on temp dirs, watcher tests run on both backends (`crates/vfs/tests`). M1.5: project tree UI (lazy listing, keyboard navigation, dimmed ignored entries, event refresh) in `ui/src/components/project/`, Vitest against a mocked engine. M1.3: `project.open`, `project.close`, `project.children` (watches listed directories, capped at 256 native / 32 polling, least recently listed dropped), `treeChanged` events from disk, `events.subscribe` on the control channel with a TCP test (`crates/control/tests/events.rs`). M1.4: the tree runs against the engine in the app: folder picker (`project.openDialog`) and `lutra-desktop --control PORT PATH` open a project, the tree lists it lazily with ignored (`var/` from `.gitignore`) and excluded (`node_modules`) entries dimmed, a file created on disk appears in an expanded folder within ~100 ms; verified with `ui.screenshot` on Windows 11 and Vitest (`ui/tests/project/`, `ui/tests/ipcEvents.test.ts`). M1.13: a directory listed only partly (more than 100,000 entries) ends with a "Listing truncated" note row (Vitest). M1.12: a folder that cannot be opened from the picker or the command line (including `unsaved_changes` when switching projects) and stopped file watching show as toasts instead of stderr (`apps/lutra-desktop/src/host.rs`, `ui/src/stores/notifications.ts`, `ui/tests/notifications/`, 19 Vitest tests; live check pending, gaming mode); score unchanged. Graded against `plan/phpstorm/02-project-view.md`: tool window, folder-first tree, dimmed ignored/excluded, keyboard navigation and live refresh exist; most toolbar, view and display options do not |
| Navigation | 10 | 0% | everything a user can reach: the go-to popup (M2.6), Structure (M2.7), find usages, go to declaration, recent files, navigation history (M1.8: a command palette over commands only; M2.5: go-to backend without UI; score unchanged) | ~112 (est.) | M2.5: symbol index in `crates/index` (every project file listed, `.php` parsed in parallel from tree-sitter outlines, vendor marked library, incremental on disk and buffer changes, capped at 200,000 files) and the engine commands `index.status`, `goto.file`, `goto.class`, `goto.symbol` (fuzzy, file names weighted, `Class::member`, project before library, partial results with `indexing: true`), events `indexProgress`/`indexReady`; 20k-file / 88 MB generated project indexed in 3.9–4.2 s (release, measured), queries 2–12 ms; tests `crates/index/tests/`, `crates/engine/tests/goto.rs`, `crates/control/tests/goto.rs`; not reachable from the UI yet (M2.6). M2.1: file outline in `crates/syntax` (namespaces braced and unbraced, classes, interfaces, traits, enums with cases, functions, methods, properties incl. promoted ones, constants; UTF-16 ranges and short signatures), the base for the Structure window (M2.7) and the symbol index (M2.5); not reachable from the UI yet, score unchanged. M1.8: `ui/src/components/palette/`, `ui/src/commands/` (fuzzy ranking, recent commands, global keymap), Vitest `ui/tests/palette/`, `ui/tests/commands/` |
| Search and replace | 6 | 0% (est.) | everything a user sees: Find in Files tool window (M2.4), replace in files, scopes, file masks UI, search history, find in path from the tree, structural search; the backend below has no UI yet, so the score stays 0% | ~76 (est.) | M2.3 backend: `crates/search` (parallel `ignore` walk + `grep-searcher`: literal/regex, case, whole word, include/exclude globs, project ignore rules with `vendor/` searched and `node_modules` skipped, binary and > 8 MiB files skipped, match cap, cancel) and engine `search.find` / `search.cancel` with `searchResults` / `searchDone` events through the pump; dirty buffers are searched in their buffer text. Tests: 9 library tests incl. a property test of random queries and file bytes (`crates/search/tests/search.rs`), 3 preview/column unit tests, 4 engine tests (`crates/engine/tests/search.rs`), a TCP control-channel test (find → results → done, invalid regex, cancel; `crates/control/tests/search.rs`). 20k-file generated tree, release: first result 10–43 ms, full walk 0.66–1.43 s (measured); live over the control channel against the running app: first result 55 ms, done 386 ms on a 5,900-file project (debug build, measured) |
| Code completion | 10 | 0% | everything | ~250 (est.) | — |
| Inspections and quick-fixes | 8 | 0% | everything | ~300 (est.) | — |
| Refactoring | 7 | 0% | everything | ~250 (est.) | — |
| Code style and formatting | 4 | 0% | everything | ~120 (est.) | — |
| Git | 8 | 0% | everything | ~150 (est.) | — |
| Terminal | 3 | 0% | everything | ~30 (est.) | — |
| Run configurations | 2 | 0% | everything | ~50 (est.) | — |
| Debugger | 5 | 0% | everything | ~120 (est.) | — |
| Testing | 4 | 0% | everything | ~80 (est.) | — |
| Composer and interpreters | 2 | 0% | everything | ~50 (est.) | — |
| Frameworks | 5 | 0% | everything | ~300 (est.) | — |
| Database tools | 3 | 0% | everything | ~250 (est.) | — |
| HTTP client | 1 | 0% | everything | ~60 (est.) | — |
| Web languages | 2 | 0% | everything | ~200 (est.) | — |
| Docker and remote | 1 | 0% | everything | ~120 (est.) | — |
| Settings, keymaps, themes | 1 | 7% (est.) | nested settings tree, project-level settings, export/import, keymaps (M1.8: one global keymap from the commands' default shortcuts, not editable), colour scheme editor, custom and imported themes, per-language colours (M1.9a: settings backend with 3 keys, persistence, `settings.*` commands, no UI yet; M1.10: light and dark themes with live switching and a system mode; M1.9b: settings dialog with search, controls by type, reset, live updates, theme picker, editor font size) | ~60 (est.) | — |
| Plug-ins | 0.5 | 0% | everything | ~120 (est.) | — |
| AI features | 0.5 | 0% | everything | ~60 (est.) | — |
Sum: about 2,920 h. Adding UI fidelity (~150 h), localization (~40 h), performance (~100 h) and stability hardening (~100 h) gives the ROADMAP's ~3,300 h to full parity. These are the raw first estimates. Cycle C1 (M1.1–M1.6) took 2.5 h of agent time for 37 h estimated (factor 0.07), so the calibrated full-parity figure is ~330 h if that speed holds for deeper areas; the ROADMAP shows the range 300–3,300 h until M2/M3 give data for language work. The range is wide (2,000–5,000 h): completion, inspections, refactoring and frameworks depend on an own type-inference engine whose size is hard to judge before M6.
Weights were reviewed at the end of M0 and kept: nothing built so far gives a reason to change them.
## What ships (M0, 2026-10-14)
No PHP feature. The foundation, verified on Windows 11:
- `cargo xtask ci` passes all 13 steps (fmt, clippy with no-panic lints, tests, lints self-test, layers, assets, clean-room, cargo-deny licences, pnpm install, ESLint, vue-tsc, Vitest, frontend licences).
- Commands `app.about` and `app.quit` with unit tests; a panicking command is caught by the guard (`crates/engine/src/engine.rs` tests).
- Control channel: `app.ping`, `engine.execute`, `engine.listCommands`, `ui.screenshot`, with proptests and a TCP integration test (`crates/control`), and checked against the running app.
- The desktop window opens themed from Rust tokens and shows the product name and version that the frontend gets from `app.about` over IPC.
## What ships (M1, done 2026-10-16)
The project tree is the first user-visible feature (Project view 8%, estimated); every other score stays 0%.
- M1.1 text buffer (`crates/text`): `Buffer` on a `ropey` rope with byte, char, UTF-16 and line counts; byte offset to line and column in UTF-16 code units or chars and back, all fallible (out of range, inside a character, inside a CRLF, inside a surrogate pair); atomic `Edit` batches in LSP `TextEdit[]` semantics that reject reversed, out-of-range and overlapping ranges; `
` / `
` / `
` detection with a keep-the-file's-ending save policy. 23 unit tests and 6 proptests (round-trips on emoji, ZWJ sequences, CJK and combining marks; random edit batches checked against a `String` model, never panicking).
- M1.10 themes (2026-10-16): Lutra Dark and Lutra Light with the same tokens, including real editor, tab and notice tokens; `appearance.theme` switches live without a reload, `system` follows the OS preference, and the window starts in the stored theme. Both themes pass a WCAG AA contrast test for every text/background pair in use. Checked by engine, control-channel and Vitest DOM tests; not yet looked at in the running app (gaming mode). No theme picker yet (settings dialog, M1.9b).
- M1.9b settings dialog (2026-10-16): `settings.open` (`Mod+,`) opens a dialog built from `settings.list` with sections, a select/number/switch per type, catalog labels and descriptions, search over label, description, key and section, Reset to default, changes applied at once with inline errors and live updates on `settingsChanged`; the theme picker switches at once and `editor.fontSize` sizes the editor. Vitest: `ui/tests/settings/SettingsDialog.test.ts` (14). Live check pending (gaming mode).
## Revision history
| Date | Change | Summary |
|---|---|---|
| 2026-10-17 | minor | M2.5: Navigation evidence (symbol index and go-to commands, no UI), score unchanged at 0%, hours 120 → 112 |
| 2026-10-16 | minor | M2.3: Search and replace evidence (find-in-files backend, no UI), score unchanged at 0%, hours 80 → 76 |
| 2026-10-16 | minor | M2.1: Editor core and Navigation evidence (tree-sitter parse, outline, folding library), scores unchanged |
| 2026-10-16 | minor | M1.9b: Settings row 4% → 7% (est.), settings dialog; M1 done |
| 2026-10-16 | minor | M1.8: Navigation and Settings/keymaps evidence (palette, global keymap), scores unchanged |
| 2026-10-16 | minor | M1.12: Project view evidence (picker errors as toasts), scores unchanged |
| 2026-10-16 | minor | M1.13: Editor core and Project view evidence (focus on re-open, watched buffer folders, truncated note), scores unchanged |
| 2026-10-16 | minor | M1.7: Editor core 8% → 9% (est.), crash-recovery journal and restore dialog |
| 2026-10-16 | minor | M1.10: Settings row 2% → 4% (est.), light/dark themes with live switching |
| 2026-10-16 | minor | M1.9a: Settings row 0% → 2% (est.), settings backend without UI |
| 2026-10-15 | minor | Calibration note after cycle C1 (factor 0.07) |
| 2026-10-15 | minor | Editor core 0% → 8% (estimated): tabs and editor in the app (M1.6) |
| 2026-10-15 | minor | Project view 0% → 8% (estimated): tree runs against the engine in the app (M1.4) |
| 2026-10-14 | minor | Project view evidence: project tree UI (M1.5), score unchanged |
| 2026-10-14 | minor | M1.3 engine workspace evidence (Editor core, Project view; scores unchanged) |
| 2026-10-14 | minor | M1.1 text buffer evidence (Editor core, score unchanged) |
| 2026-10-14 | minor | Project view evidence: native file watching (M1.2b), score unchanged |
| 2026-10-14 | minor | Project view evidence: `lutra-vfs` (M1.2), score unchanged |
| 2026-10-14 | minor | Hours per area, weights reviewed, M0 evidence |
| 2026-10-13 | major | Baseline |