GEstimator

Frontend architecture and workspace contracts

Current contract, checked against source on 2026-11-23. Navigation: index · architecture · backend · UI rules · verification.

Ownership and module map

Vue collects input and renders Python results. It owns view state, not estimates, rate calculations, numeric expression evaluation or persistence rules. Monetary formatting is presentation; the currency option does not convert prices.

Concern Owner
App mounting, PrimeVue, styles and shared input installation main.ts
Active document workspace lifetime Root.vue
Document/session store and actions documents.ts, useDocumentTabs.ts
Shell, ribbon/context, guarded navigation and coordination App.vue
Project file dialogs, recent paths, recovery and guarded file workflows useProjectFiles.ts
View/history navigation and document-local memory useWorkspaceNavigation.ts
MCP change polling and workspace refresh coordination useWorkspaceMCP.ts
Analysis requests, authoritative state and selection refresh useWorkspace.ts
Analysis resource, workbook, custom template and project analysis rules dialogs AnalysisDialogs.vue
Selected analysis row fields, amounts and inspector actions AnalysisInspector.vue
Schedule/resource/measurement workspaces ProjectViews.vue
Measurement record page, detail loading, description edit and record memory useMeasurementRecords.ts
Staged measurement/category properties and schedule-link picker useMeasurementProperties.ts
Project-view/measurement response and tab-memory types projectViewTypes.ts
Measurement column presentation and Tabulator type compatibility measurementColumns.ts
JSON request transport and shared analysis types backend.ts
Project and analysis grid lifecycle DataTable.vue, AnalysisTable.vue
Tab memory, row clipboard, cell navigation/editing and selection tabMemory.ts, rowClipboard.ts, cellNavigation.ts, tableTextEditor.ts, tableSelection.ts
Display formatting and appearance numberFormatting.ts, appearance.ts
Program settings and shared helpers programSettings.ts, uiActions.ts, statusNotice.ts
MCP control/status and library restoration mcp.ts, libraryPreferences.ts
Native file-open/drop routing projectOpening.ts

Before adding behavior to a shell/view, check for an existing shared helper. Extract a separate concern into a composable or component with explicit inputs and cleanup. The quality audit tracks the remaining shell and project view concerns.

Document and view lifetimes

documents.ts maps document tabs to backend sessions and marks the active one. Root.vue keys App by the active document, so switching documents unmounts one workspace and mounts another. Backend projects and drafts remain alive; local component state does not automatically survive remounting.

tabMemory.ts stores document-specific navigation, selection, paging and scroll state for restoration. useWorkspaceNavigation owns editor/ribbon state, history, record-page identity, inspector visibility and the workspace memory snapshot. It receives the shell’s draft guard and analysis-loading/focus callbacks, keeping one guard path. A new/replaced project or closed document forgets its old state. useDocumentTabs routes New/Open/Close and window close through that same guard; do not bypass it from a new button or native callback.

useProjectFiles owns New/Open/Save/Close orchestration, the file-dialog state, recent paths, recovery choices and OS-open completion/handoff state. It delegates session switching to useDocumentTabs and persistence to useWorkspace/Python. The shell supplies the same draft guard and a post-save continuation, retaining pending actions and measurement-view refresh in one place. Cancelling that guard also settles the composable’s pending native open; displaying the dialog alone must not release the OS request queue. projectOpening.ts still owns native event/drop serialization; the shell installs it after reconnect and cleans up its listeners on unmount. New entry points reuse these paths.

Schedule/Analysis/Resources/Measurements select editors. Databases and MCP select ribbon context while preserving the active editor. Active project views are retained within a mounted workspace to preserve their state. Keep this separate from document switching, which changes backend session and remounts it.

Requests, stale edits and refresh

backend.ts wraps Tauri backend_request with a unique ID and explicit document session. Request orchestration sends the current backend revision for writes. The Python result is the final authority, including numeric strings, totals, draft flags and history availability.

Refresh should reconcile selections by stable ID and preserve scroll/focus where valid. Do not use a visible row index as an item identity. Hidden category contents and off-page rows are resolved by backend selection expansion; frontend filtering cannot define deletion, import or total scope.

useWorkspaceMCP polls change sequence/project epoch and refreshes the active workspace. Refresh is deferred around human edits and dialogs. A stale edit is rejected with its input retained for correction; do not silently overwrite it with an agent’s new value. Poll state is local to the mounted workspace, seeded from current MCP status after initialization and cleared on unmount. Do not replay earlier agent writes as project replacements when switching back to a document. See MCP synchronization and backend revisions.

Grids and drafts

The analysis dialogs use the mounted workspace’s selection, revision, commands and error state. AnalysisDialogs owns the custom resource form, database resource picker, workbook import and export, custom template, and project analysis rule dialog. It keeps the insertion group selected when a resource action starts and uses the selected row as the insertion point when that row belongs to the same group. The shell still handles keyboard routing, database manager requests and the schedule reload and navigation after applying rules.

AnalysisInspector renders the workspace’s selected analysis row and emits field edits and row actions. The shell routes field edits through the same callback as the analysis grid. useWorkspaceNavigation owns inspector visibility and restores it when switching back to an open document tab.

Tabulator is a rendering/editing adapter. It does not own authoritative undo or calculation history. Reuse the table input, arrow/Tab navigation, selection, clipboard, tooltip and virtual-row helpers instead of making view-specific copies. Confine unavoidable access to third-party internals to a documented adapter.

Raw editable numeric strings may be expressions. Keep them distinct from rendered results; send validation to Python. Derived cells remain read-only. GroupTotal analysis rows and generated record serial numbers are display-only, not new domain rows to select, edit, copy or persist.

Analysis and records have explicit Apply/Discard boundaries. Accepting a draft changes the working project; Save publishes a project file. A failed acceptance retains the editor and draft. Dirty drafts must be guarded during navigation, project replacement and close. Detailed action placement, keyboard semantics, numeric formatting and accessible states belong in the UI guidelines.

useMeasurementRecords owns the record page, selection, table/description refs, description edit recovery and draft-aware detail loading. Its request-token, item-ID and revision checks reject superseded detail responses before replacing view state. ProjectViews still owns the common command, busy/error recovery, main-table state and document-memory snapshot. The composable contributes its matching record-page memory to that snapshot and restores it after detail loads. It delegates focus, change notifications and commands through explicit callbacks; it does not create another draft history or navigation guard.

useMeasurementProperties stages description, links and template constants in a separate form snapshot with the original revision. Its picker supports both staged properties and the active record editor’s link action. Save uses the common command; validation, calculations and undo remain in Python.

The measurement detail contract in projectViewTypes.ts distinguishes raw record strings, calculated display strings, template metadata, links, properties and totals. Extend it alongside the backend response. Main-table GridRow and the generic DataTable callbacks still have dynamic typing tracked by the audit. measurementColumns.ts isolates the existing Tabulator options missing from its published types (editor: false and DOM header tooltips). Keep the compatibility cast there and preserve text-node rendering for author data.

Preferences, styles and text

Program/appearance/MCP/library preferences are application settings, separate from .eproj project metadata. Program settings are validated by Python and stored in versioned frontend preferences. Do not add project-specific state to a global preference or store derived backend totals as preferences.

Semantic tokens belong in theme.css; shared styles in style.css. Reuse AppIcon, RibbonToolbar, PersistentDialog, ThemedDropdowns and ThemedAutocomplete. Prefer changing the owning shared rule over adding duplicate selectors at the end of the stylesheet. Preserve cascade order in any CSS extraction.

User data is rendered as text. Only the shared escaped markdown.ts renderer formats author notes; do not insert untrusted HTML into Tabulator, Vue or tooltips. User-facing labels describe GEstimator behavior, not internal migration/GTK implementation history.

Extending a frontend workflow

  1. Identify its backend operation and typed request/result shape. Add missing validation in Python, not a competing JavaScript implementation.
  2. Put reusable orchestration in a composable/helper and bounded UI in a component. Keep pending/busy/error ownership explicit.
  3. Preserve keyboard and pointer interaction, focus, row identity and tab memory. Clean up listeners, timers and table instances when the owner unmounts.
  4. Reuse the existing unsaved-work guard and status/error presentation. Wait for command completion before navigating or asserting an asynchronous result.
  5. Verify the affected browser behavior through the real Python bridge, and use installed native builds for OS dialogs, file associations and WebView-specific behavior. Follow the testing guide.

The main browser suite is workspace.spec.ts; fixtures live in modern/e2e/. Relevant backend coverage includes desktop refresh, document sessions and records drafts. Type checking is strict in tsconfig.json; do not broaden any or casts to hide a disagreement at an IPC boundary.