feat(FN-1228): complete Step 1 — Backend API Routes modifications

- Modified POST /api/nodes to make type optional (defaults to 'remote')
- Changed DELETE /api/nodes/:id to return 204 No Content
- Updated GET /api/nodes/:id/metrics to return SystemMetrics from node.systemMetrics
- Added GET /api/mesh/state route for full mesh topology state
This commit is contained in:
gsxdsm
2026-04-09 11:51:03 -07:00
parent 26ff7eb900
commit ea8d32d4bf
13 changed files with 497 additions and 8 deletions

View File

@@ -73,3 +73,10 @@
- When checking if a CSS value is inside a `@media` block, don't just search backwards for the nearest `@media` — track brace depth to confirm the line is actually between the block's opening `{` and closing `}`. Many component styles are defined globally (not in media queries) even though they visually only appear on mobile.
- Regex tests using `[\s\S]*` (greedy match across lines) to check CSS rules inside `@media` blocks are unreliable — they can match across block boundaries. Use non-greedy `[^}]*` scoped to a single rule block instead.
- Touch target sizing in `styles.css` mobile media queries uses 36px (reduced from the original 44px). The `.touch-target` opt-in utility class remains at 44px. Comments mentioning "44px" in the mobile sections have been updated to reflect the actual values.
## TUI Package Testing
- The `@fusion/tui` package uses `ink`'s `render` function for testing, not `@testing-library/react`. Use `setTimeout(resolve, ms)` to wait for async operations in tests.
- When mocking `useFusion` in TUI tests, use `vi.mock("../fusion-context.js", ...)` to intercept the import.
- For EventEmitter mocking in TUI tests, create mock objects with `Object.create(EventEmitter.prototype)` and add methods like `listTasks` or `getActivityLog`.
- Ink's render function captures errors but doesn't throw them — use `expect(() => instance.unmount()).not.toThrow()` pattern for error-handling tests.