Massive AI Overhaul

This commit is contained in:
John OReilly
2026-03-15 18:24:36 -04:00
parent bce93507cb
commit 42b7b06dda
9637 changed files with 403289 additions and 4217 deletions

124
docs/code-verification.md Normal file
View File

@@ -0,0 +1,124 @@
# Code Verification
## Latest checkpoint
- Date: March 15, 2026
- Verification: automated quote engine tests (88/88 passing) + visual review
- Status: Phases 13 complete (bug fixes, visual polish, UX hardening)
## Automated test suite
**Location:** `svsmspcalc/tests/test-quote-engine.js`
**Run:** `node svsmspcalc/tests/test-quote-engine.js`
**Result:** 88 tests passing across 21 test groups
### What's covered
| Area | Tests |
|------|-------|
| M365 vs BYOL rates | User base rates, rate switching |
| Admin fee scaling | Floor ($150), minimum ($650), ZT premium ($250), 1Password markup (10%) |
| Admin waiver | Fee calculated but excluded from MRR |
| User add-ons | Extended Hours, 1Password, INKY, Zero Trust per-user |
| Endpoint add-ons | USB Blocking, Bare Metal Backup |
| Server pricing | Per-server rate, inclusion in subtotals |
| Contract discounts | m2m (0%), 12mo (3%), 24mo (5%) |
| HST | 13% applied after discount, disabled = 0, combo with discount |
| VoIP | All 3 tiers, phone + fax add-ons |
| Zero Trust networking | Seats + routers |
| Edge cases | Zero users, per-user breakdowns |
| MRR integrity | MRR = sum of components across 5 different configs |
| Realistic scenario | Full 22-user quote with all features |
### How to extend
- Add `describe()` / `it()` blocks in the test file
- Uses `eq(actual, expected, label)` for exact assertions
- Uses `near(actual, expected, tolerance, label)` for floating-point
- Ask Claude to add tests for new scenarios
## What is currently known-good
### Section header redesign (completed this session)
- All 6 sections use unified `sec-controls-row` pattern (stepper + badge + price on row 2)
- Subtitles moved to row 3, visible only when expanded
- Section headers use CSS grid: numeral + title + chevron on row 1
- Container query at ≤520px and media query at ≤600px handle small-screen stacking
- Cascade order issues resolved (container query overrides placed after base rules)
### UI/UX changes (completed this session)
- ~15-20% spacing optimization across all tokens, layout, components, and responsive CSS
- All sections default to collapsed state on load
- Inner collapsibles (What's Included, Add-Ons) default to collapsed
- "What This Fee Supports" card removed from SEC-01
- "Protection First, Recovery Optional" card removed from SEC-03
- Progress bar always visible when SEC-01 is collapsed
- Floor note restyled to match title font (DM Mono, 12px, uppercase)
- Summary badges show price only (no counts — stepper already shows quantity)
### Print/export changes
- Print now respects user's HST toggle (Phase 1 fix — no longer forces HST on)
- JSON export includes `version: '1.0'` schema field (Phase 1 addition)
- Print CSS hides `sec-controls-row` instead of old `sec-collapsed-counter`
### Dead code removed
- `sec-collapsed-counter` CSS and HTML (replaced by `sec-controls-row`)
- `floorProgress` span (right-side threshold text)
## Runtime areas that must stay intact
- Quote calculations (now verified by automated tests)
- Exports
- Local persistence
- Theme switching
- Mobile quote sync/parity
### Phase 1 bug fixes (verified)
- ADDON_INKY default: $5 → $8 in quote-pricing.js (test expectations updated)
- Onboarding fee manual override preserved across term switches (data-manual-value attribute)
- VoIP fax CSV comment: "Flat/mo" → "Per seat/mo"
- Print HST: now respects user toggle instead of forcing HST on
- JSON export: schema version '1.0' added
- ZT admin supplement: amber nudge warning when ztActive
### Phase 2 visual polish (verified)
- Hardcoded danger icon color → `var(--text-danger)`
- Hardcoded pill-savings active color → `var(--text-pill-savings-active)` (new token in all 4 themes)
- All 4 themes fully token-covered for Sections IIII
- No remaining hardcoded colors in active section CSS
### Phase 3 UX hardening (verified)
- Smooth theme-switch transition (0.25s crossfade via `.theme-transitioning`)
- Nudge crossfade on rotation/nav (180ms fade-out → swap → fade-in)
- Summary badge fade-in on collapse (0.25s animation)
- Addon toggle micro-feedback (0.2s scale pulse)
- Touch targets ≥44px on mobile (close btn, nudge nav, section toggles)
- Mobile focus trap in panel (Tab cycles within, focus returns to pill on close)
- Safe-area insets for notch phones (pill position, panel padding)
### Phase 5 accessibility & performance fixes (verified)
- `aria-expanded` on all section toggles and collapsible headers (12 elements)
- Focus trap on reset confirm modal (Tab cycles within modal)
- `aria-label` on all stepper buttons (12 elements: "Decrease/Increase users/endpoints/etc.")
- Glass theme `background-attachment: scroll` on mobile (≤1100px) to prevent iOS scroll jank
- Mobile sync guard: skips 35+ element sync when panel closed on desktop
- Mobile sync gaps fixed: `sidebarFocusClientName`, `sl-discount-detail`, `sl-value-onboarding-label` added to sync map
- Full sync forced on `openMobilePanel()` to ensure fresh data
### Font Awesome icon fix (verified)
- All 36 FA Sharp Solid icon references in components.css converted from file paths to inline `data:image/svg+xml` URIs
- Icons now render on `file://` protocol without a server
- If adding new icons: use inline data URI format, not file path references
## What still needs caution
- DOM rendering tests (sidebar values, warnings, mobile sync) are not yet automated
- Export/persistence tests are not yet automated
## Required check standard for future edits
- After pricing/engine edits: run `node svsmspcalc/tests/test-quote-engine.js`
- After JS edits: run syntax checks
- After logic edits: review quote math, persistence, export, and mobile parity impact
- After sidebar changes: verify the mobile clone/sync map still covers the changed elements
- After copy or styling edits in sales-critical areas: check readability and messaging