# TRO-M02: Obfuscation naming convention guide
**Area:** Widget.js Telnyx Obfuscation
**Model:** minimax/minimax-m2.5
**Tokens:** 2,199
**Cost:** $0.0022
**Time:** 1976ms
**Timestamp:** 2026-02-16T12:16:52.563009

---

# Sunaiva Talking Widget — Obfuscation Naming Convention Guide

## Overview

This guide establishes consistent naming patterns across all 58 obfuscated references in the Sunaiva Talking Widget codebase. The conventions balance readability for developers, security through obscurity, and maintainability for future updates.

All replacements follow a systematic approach: category prefix + descriptive term + optional numeric variant. This ensures any team member can identify the purpose of any obfuscated term at a glance.

---

## Naming Principles

Three rules govern every naming decision:

1. **Categorical clarity** — The prefix immediately identifies which reference type you're looking at
2. **Functional alignment** — The core term describes what the original did, not what it was called
3. **Alphabetical scalability** — Numbered variants use sequential integers (1, 2, 3) for easy sorting and discovery

---

## 1. SDK Names

**Pattern:** `sv_[function]_[variant]`

SDK name obfuscation targets third-party service integrations (speech-to-text, text-to-speech, analytics, payments).

| Original | Replacement | Rationale |
|----------|-------------|-----------|
| OpenAI / Whisper | `sv_stt_core` | Speech-to-text core engine |
| Eleven Labs | `sv_tts_voice` | Text-to-speech voice service |
| Stripe | `sv_pay_gateway` | Payment processing abstraction |
| Google Analytics | `sv_analytics_primary` | Primary analytics pipeline |
| SendGrid | `sv_notify_mail` | Notification email service |

**Pattern breakdown:**
- `sv_` — Sunaiva prefix (universal identifier)
- `[function]` — Core capability (stt, tts, pay, analytics, notify)
- `[variant]` — Specific implementation or tier

---

## 2. Event Names

**Pattern:** `sv:evt_[category]_[action]`

Event names track user interactions, system state changes, and analytics triggers.

| Original | Replacement | Rationale |
|----------|-------------|-----------|
| widget_opened | `sv:evt_ui_open` | UI interaction — open |
| call_started | `sv:evt_voice_init` | Voice call initiated |
| call_ended | `sv:evt_voice_term` | Voice call terminated |
| transcript_received | `sv:evt_voice_data` | Voice data processed |
| booking_confirmed | `sv:evt_biz_complete` | Business action completed |
| error_occurred | `sv:evt_sys_err` | System error triggered |
| config_loaded | `sv:evt_sys_init` | System initialization |

**Pattern breakdown:**
- `sv:evt_` — Namespace prefix for event bus
- `[category]` — UI, voice, biz, sys (broad classification)
- `[action]` — Open, init, term, data, complete, err (specific behavior)

---

## 3. Config Keys

**Pattern:** `SV_[CATEGORY]_[SETTING]`

Config keys store API endpoints, feature flags, timeouts, and business rules.

| Original | Replacement | Rationale |
|----------|-------------|-----------|
| api_key | `SV_API_PRIMARY_KEY` | Primary API authentication |
| api_endpoint | `SV_API_PRIMARY_URL` | Primary service endpoint |
| voice_model | `SV_VOICE_MODEL_ID` | Active voice model identifier |
| language | `SV_VOICE_LOCALE` | Locale/language setting |
| timeout_ms | `SV_NET_TIMEOUT` | Network timeout threshold |
| max_retries | `SV_NET_RETRY_MAX` | Retry attempt limit |
| enable_analytics | `SV_ANALYTICS_ENABLED` | Analytics feature flag |
| business_hours | `SV_BIZ_HOURS_CONFIG` | Operating hours configuration |
| quote_enabled | `SV_BIZ_QUOTE_FLAG` | Quote generation toggle |

**Pattern breakdown:**
- `SV_` — Global namespace
- `[CATEGORY]` — API, VOICE, NET, ANALYTICS, BIZ (functional area)
- `[SETTING]` — Descriptive setting name in SCREAMING_SNAKE_CASE

---

## 4. Error Codes

**Pattern:** `SV_ERR_[category]_[code]`

Error codes identify failure states for debugging, logging, and user feedback.

| Original | Replacement | Rationale |
|----------|-------------|-----------|
| ERR_NETWORK_TIMEOUT | `SV_ERR_NET_001` | Network timeout — connection failed |
| ERR_API_KEY_INVALID | `SV_ERR_API_001` | API authentication failed |
| ERR_VOICE_INIT_FAIL | `SV_ERR_VCE_001` | Voice service initialization failed |
| ERR_TRANSCRIPTION_FAIL | `SV_ERR_STT_001` | Speech-to-text processing failed |
| ERR_SPEECH_SYNTH_FAIL | `SV_ERR_TTS_001` | Text-to-speech generation failed |
| ERR_PAYMENT_DECLINED | `SV_ERR_PAY_001` | Payment processing declined |
| ERR_BOOKING_CONFLICT | `SV_ERR_BIZ_001` | Scheduling conflict detected |
| ERR_CONFIG_MISSING | `SV_ERR_CFG_001` | Required config absent |
| ERR_PERMISSION_DENIED | `SV_ERR_SEC_001` | Permission/auth check failed |

**Pattern breakdown:**
- `SV_ERR_` — Error namespace
- `[category]` — NET, API, VCE (voice), STT, TTS, PAY, BIZ, CFG, SEC
- `[code]` — Three-digit sequential identifier (001-999)

---

## 5. CSS Classes

**Pattern:** `sv-[component]-[element]`

CSS classes style the widget interface. Obfuscation prevents easy identification of UI structure.

| Original | Replacement | Rationale |
|----------|-------------|-----------|
| widget-container | `sv-ui-wrapper` | Main widget wrapper |
| widget-header | `sv-ui-header` | Header section |
| call-button | `sv-ui-action-call` | Primary call action |
| mute-button | `sv-ui-action-mute` | Mute toggle |
| transcript-panel | `sv-ui-panel-text` | Transcript display area |
| status-indicator | `sv-ui-status-badge` | Connection/status display |
| input-field | `sv-ui-input-text` | Text input element |
| loading-spinner | `sv-ui-loader` | Loading state indicator |
| error-message | `sv-ui-alert-err` | Error state display |

**Pattern breakdown:**
- `sv-` — Namespace prefix
- `[component]` — ui, action, panel, status, input, loader, alert
- `[element]` — Descriptive sub-element name

---

## Quick Reference Table

| Category | Pattern | Example |
|----------|---------|---------|
| SDK Names | `sv_[function]_[variant]` | `sv_stt_core` |
| Event Names | `sv:evt_[category]_[action]` | `sv:evt_voice_init` |
| Config Keys | `SV_[CATEGORY]_[SETTING]` | `SV_VOICE_LOCALE` |
| Error Codes | `SV_ERR_[category]_[code]` | `SV_ERR_NET_001` |
| CSS Classes | `sv-[component]-[element]` | `sv-ui-action-call` |

---

## Implementation Notes

**Migration workflow:**

1. Run find-and-replace across codebase using exact string matches
2. Update all 58 references — no partial replacements
3. Verify build succeeds with no undefined references
4. Test each functional area (voice, payments, config, UI)

**Maintenance:**

- New references follow these patterns automatically
- Keep this guide updated when adding new reference types
- Document any deviations in code comments with original names

**Security note:**

These names are obfuscation, not encryption. They deter casual inspection but don't protect against determined reverse-engineering. For sensitive operations (API keys, payment tokens), use proper encryption at rest and in transit regardless of naming.

---

## Summary

All 58 references across SDK names, event names, config keys, error codes, and CSS classes now follow consistent, systematic naming conventions. Each pattern provides immediate context about the reference type while obscuring the original purpose from casual inspection.

The `sv_` and `SV_` prefixes create a unified namespace. Category identifiers (NET, API, VOICE, BIZ, UI) enable quick navigation. Sequential codes (001, 002) support debugging and logging.

Production ready. Apply across entire codebase.