Navigation: documentation index · architecture overview · testing · UI guidelines.
These guidelines apply to the current code and to the modernisation work. Mandatory rules are summarised in AGENTS.md; this page explains how to follow them.
- Identify the layer that owns the change (ARCHITECTURE.md).
- Read the contract for that layer in
docs/architecture/and, for migration work, the milestone in the implementation plan. - Check the feature inventory for affected user behaviour and the risk register.
- Work on a feature branch; keep each change focused and reviewable.
- Python:
pixi install; run everything withpixi run .... Add Python dependencies withpixi addand commitpixi.tomlandpixi.lock. Usepixi add --pypionly for pure-Python packages missing or outdated on conda-forge (pandapower, ADR 0015). Target Python 3.14 from M1b. - JavaScript (current since M6): Node.js 24 LTS (
.nvmrc) with npm;npm ciat the repository root installs all workspaces (modern,packages/*). Dependencies are pinned to exact versions (.npmrcsave-exact=true); only peer dependencies use ranges. New dependencies must have a licence thatnpm run check:licencesaccepts (MIT-compatible for EngineeringUI). Commitpackage-lock.json.npm run checkruns all frontend checks. - Rust (from M5): stable toolchain via rustup; commit
Cargo.lock.
| If you are changing... | Do it in | Never in |
|---|---|---|
| A calculation, field rule, element behaviour, connectivity | Engine (gelectrical/) |
Services, Vue, Rust, MCP descriptions |
| How a user action changes the project | Service command | Vue components |
| What is displayed and how it is interacted with | Vue / EngineeringUI | Python services (beyond data shape) |
| Process lifecycle, native dialogs | Rust / modern/src/services/native.ts |
Engine |
| AI tool surface | modern/backend/mcp/ |
Engine, services' internals |
| Reusable visual component | EngineeringUI | modern/src/components/ (if reused) |
The engine imports no GTK, Tauri, MCP, transport or modern code. Services
import no transport. EngineeringUI imports nothing from modern/ or
gelectrical/.
- Do not change engineering results while refactoring. Run the
regression baseline for any change under
gelectrical/. - An intended correction needs an ADR, before/after values on sample and coverage projects, owner approval and a baseline update in the same PR.
- Keep units explicit in names or field metadata (
_kv,_ka,_km,_mva). - Keep element classes the single source of truth for field definitions and side effects; generate schemas from them.
- Keep old
.geprofiles loadable; follow the project format policy. - Element codes and field codes are permanent.
- Never evaluate project, clipboard, database or request text with
eval,execorpickle; usegelectrical.core.expressions(from M3). - Open text files with
encoding='utf-8'. - Save atomically; never leave a partially written project.
- Every mutation is a service command inside a transaction: validate first,
apply through engine methods, one undo entry, one revision increment, one
changedevent. - Previews roll back completely (state, history, revision, dirty flag).
- Long work (analysis, exports) runs as a job, never on the owner thread.
- Desktop and MCP use the same command; do not add MCP-only write paths.
- Treat ~600 lines per module and ~80 lines per function as review triggers
(GEstimator rule), not targets. The legacy files
line.py,pandapower.py,switch.pyandproject.pyalready exceed this; do not add unrelated responsibilities to them. - Extract a named helper, component or composable before growing a shell file
(
App.vue, service routers). - Remove superseded code in the same change. Do not split files into numbered parts or hide state in mixins.
- Python: match surrounding style; 4-space indents;
log = logging.getLogger(__name__); log messages as'Class - method - message'. New modules: module docstring, docstrings for public functions, short step comments for multi-step logic. A formatter configuration (Ruff, as in GEstimator) is proposed for new modules only in M1; do not reformat legacy files wholesale. - TypeScript/Vue: strict TypeScript; Prettier (2 spaces, double quotes,
semicolons, 120 columns, as GEstimator);
<script setup lang="ts">; scoped styles using tokens. - Rust:
rustfmt, Clippy with warnings denied; propagate errors withResult. - Comments explain why and constraints; avoid narrating obvious code.
- Code adapted from GEstimator keeps its header and adds
Adapted from GEstimator <path> at <commit>. Insidepackages/engineering-ui/(MIT), adapted GEstimator code is relicensed to MIT by the copyright holder and uses the MIT header instead. - New dependencies of EngineeringUI must be MIT-compatible (MIT, BSD, Apache-2.0, ISC).
- Do not copy code from Open Planner Studio or other projects; use them as visual references only unless an ADR approves reuse with licence review.
- New dependencies: check licence compatibility with GPL-3.0-or-later and record notable ones in the licence inventory.
New data directories (databases, templates, icons, symbols, skills, fonts)
must be added to the sidecar spec (modern/sidecar/gelectrical-backend.spec)
and, where the shell reads them, to the Tauri resources.
- Run the checks for the changed layers (testing).
- Update the contract document if behaviour or ownership changed.
- Update the feature inventory and append evidence to the validation log for migration work.
- Describe in the PR what changed, what was verified and what was not.