chore: reorganize rules files — consolidate duplicates

Migrates legacy rule numbering (18, 20) to standardized sequence (53, 54) and adds new 18-preexisting-issues.md for handling pre-existing issues during development. This consolidates duplicate rule coverage across the old and new numbering schemes.

Files changed:
- Removed: 18-relative-units.md (moved to 53-relative-units.md)
- Removed: 20-testing-gate.md (moved to 54-testing-gate.md)
- Added: 18-preexisting-issues.md (new)
- Added: 53-relative-units.md (renamed from 18)
- Added: 54-testing-gate.md (renamed from 20)
This commit is contained in:
Hibryda 2026-03-12 06:47:47 +01:00
parent 65973fbf06
commit ee198a2fdb
3 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,12 @@
# Preexisting Issues
Never ignore problems you encounter in the codebase, even if they are outside the current task scope.
## Rules
- When you encounter a bug, lint error, type error, broken test, or code smell while working on a task, do not skip it.
- If the fix is straightforward (under ~15 minutes of work), fix it in a separate commit with a clear message explaining what was wrong.
- If the fix is complex (large refactor, architectural change, risk of regression), stop and inform the user: describe the issue, its severity, where it lives, and propose a plan to fix it. Do not attempt complex fixes without approval.
- Never suppress warnings, disable lint rules, or add `// @ts-ignore` to hide preexisting issues. Surface them.
- When fixing a preexisting issue, add a test that would have caught it if one does not already exist.
- Track issues you cannot fix immediately: flag them to the user and, if Memora is available, create an issue memory.

View file

@ -0,0 +1,17 @@
# Relative Units (CSS)
Use relative units (`em`, `rem`, `%`, `vh`, `vw`) for layout and spacing. Pixels are acceptable only for:
- Icon sizes (`width`/`height` on `<svg>` or icon containers)
- Borders and outlines (`1px solid ...`)
- Box shadows
## Rules
- **Layout dimensions** (width, height, max-width, min-width): use `em`, `rem`, `%`, or viewport units.
- **Padding and margin**: use `em` or `rem`.
- **Font sizes**: use `rem` or `em`, never `px`.
- **Gap, border-radius**: use `em` or `rem`.
- **Media queries**: use `em`.
- When existing code uses `px` for layout elements, convert to relative units as part of the change.
- CSS custom properties for typography (`--ui-font-size`, `--term-font-size`) store `px` values because they feed into JS APIs (xterm.js) that require pixels. This is the only exception beyond icons/borders.

View file

@ -0,0 +1,32 @@
# Testing Gate (Post-Implementation)
Run the full test suite after every major change before considering work complete.
## What Counts as a Major Change
- New feature or component
- Refactoring that touches 3+ files
- Store, adapter, or bridge modifications
- Rust backend changes (commands, SQLite, sidecar)
- Build or CI configuration changes
## Required Command
```bash
cd v2 && npm run test:all
```
This runs vitest (frontend) + cargo test (backend). For changes touching E2E-relevant UI or interaction flows, also run:
```bash
cd v2 && npm run test:all:e2e
```
## Rules
- Do NOT skip tests to save time. A broken test suite is a blocking issue.
- If tests fail, fix them before moving on. Do not defer test fixes to a follow-up.
- If a change breaks existing tests, that's signal — investigate whether the change or the test is wrong.
- When adding new logic, add tests in the same commit (TDD preferred, see rule 06).
- After fixing test failures, re-run the full suite to confirm no cascading breakage.
- Report test results to the user: pass count, fail count, skip count.