id: 5d8afd31e7454b43865c8d154ed0af8a
parent_id: a4ed47acdd624e71b9ec4c9a7fa9643e
item_type: 1
item_id: 6c0dcb2a567348fd9796f50c790082e4
item_updated_time: 1780470248749
title_diff: "[]"
body_diff: "[{\"diffs\":[[0,\"sitories\"],[1,\" & Deployment\"],[0,\"\\\n\\\n### Re\"]],\"start1\":6106,\"start2\":6106,\"length1\":16,\"length2\":29},{\"diffs\":[[0,\"a |\\\n\"],[-1,\"| **Local path** | `~/IdeaProjects/ac-telemetry-plugin` |\\\n\"],[0,\"| **\"]],\"start1\":6274,\"start2\":6274,\"length1\":66,\"length2\":8},{\"diffs\":[[0,\"| **\"],[-1,\"Status** | **Phase 1.1 — bug found, needs fix** — commit `3900d2a` |\\\n\\\n**Implementation details:**\"],[1,\"Git commit** | `3900d2a` (`feat: initial AC telemetry Lua plugin`) |\\\n| **Status** | **Phase 1.1 — bug found, needs fix** |\\\n\\\n**🐛 CONFIRMED BUG: `require(\\\"socket.udp\\\")` is incorrect** — see Section 13.2 for details\\\n\\\n#### Folder Paths (Three Copies Currently Exist)\\\n\\\n| Role | Path | Git Status | manifest.ini | main.lua |\\\n|---|---|---|---|---|\\\n| **Project source** | `~/IdeaProjects/ac-telemetry-plugin` | `3900d2a` clean | `[SCRIPT]` (headless) | No `script.windowMain` |\\\n| **App deployment** | `<AC>/apps/lua/ac-telemetry-plugin/` | `3900d2a` **dirty** (modified manifest.ini, main.lua; untracked icon.png) | `[WINDOW_...]` (app window) | Has `script.windowMain` + `ui.text()` |\\\n| **Extension deployment** | `<AC>/extension/lua/ac-telemetry-plugin/` | `3900d2a` clean | `[SCRIPT]` (headless) | No `script.windowMain` |\\\n\\\n`<AC>` = `/home/jan/.steam/debian-installation/steamapps/common/assettocorsa`\\\n\\\n**Core files are identical across all three**: `config.lua`, `src/telemetry.lua`, `src/json.lua`\\\n\\\n**The app deployment has uncommitted local modifications**: The `manifest.ini` and `main.lua` were manually edited in the apps/lua copy to add `[WINDOW_...]`, `[CORE]`, `LAZY = FULL`, and `script.windowMain`. These changes were never committed to git.\\\n\\\n#### Deployment Workflow\\\n\\\n```\\\n~/IdeaProjects/ac-telemetry-plugin/          ← Edit here (git repo, IntelliJ project)\\\n    ↓ copy/symlink\\\n<AC>/apps/lua/ac-telemetry-plugin/           ← Deploy here (CSP loads as in-game app)\\\n```\\\n\\\n**Action items:**\\\n1. **Merge the app modifications back into the project source** — commit the `[WINDOW_...]` manifest, `script.windowMain`, and `icon.png` into the git repo\\\n2. **Delete `<AC>/extension/lua/ac-telemetry-plugin/`** — prevents double loading\\\n3. **Use the project source as the single source of truth**, deploy only to `apps/lua/`\\\n\\\n#### Implementation details:\"],[0,\"\\\n- B\"]],\"start1\":6481,\"start2\":6481,\"length1\":105,\"length2\":1857},{\"diffs\":[[0,\"a`\\\n\\\n\"],[-1,\"**🐛 CONFIRMED BUG: `require(\\\"socket.udp\\\")` is incorrect** — see Section 13 for details\\\n\\\n\"],[0,\"**Fi\"]],\"start1\":9030,\"start2\":9030,\"length1\":97,\"length2\":8},{\"diffs\":[[0,\"riptor)\\\n\"],[1,\"├── icon.png              (app bar icon)\\\n\"],[0,\"├── conf\"]],\"start1\":9109,\"start2\":9109,\"length1\":16,\"length2\":57},{\"diffs\":[[0,\"t.update\"],[1,\" + windowMain\"],[0,\")\\\n├── sr\"]],\"start1\":9280,\"start2\":9280,\"length1\":16,\"length2\":29},{\"diffs\":[[0,\"] **\"],[-1,\"CLEANUP: Remove duplicate in `extension/lua/ac-telemetry-plugin/`** to prevent double UDP transmission\\\n  - [ ] **DECIDE: apps/lua vs extension/lua deployment** — see Section 13.4\"],[1,\"MERGE: Commit app variant into git** — manifest.ini with `[WINDOW_...]`, `script.windowMain`, `icon.png`\\\n  - [ ] **CLEANUP: Delete `extension/lua/ac-telemetry-plugin/`** to prevent double UDP transmission\\\n  - [ ] **ADD: Debug logging** — `ac.log()` and `ac.debug()` calls for troubleshooting\\\n  - [ ] **VERIFY: Check CSP log after fix** — confirm no more Lua errors, UDP packets flow\"],[0,\"\\\n\\\n- \"]],\"start1\":14298,\"start2\":14298,\"length1\":186,\"length2\":390},{\"diffs\":[[0,\"ot cause\"],[1,\" and log analysis\"],[0,\"*\\\n\\\n### 1\"]],\"start1\":19454,\"start2\":19454,\"length1\":16,\"length2\":33},{\"diffs\":[[0,\"dow \"],[-1,\"in `ac-telemetry-plugin`\"],[1,\"AND no UDP packets\"],[0,\".**\\\n\"]],\"start1\":20266,\"start2\":20266,\"length1\":32,\"length2\":26},{\"diffs\":[[0,\"/ftp.lua\"],[-1,\"\\\nsocket/\"],[1,\", \"],[0,\"headers.\"]],\"start1\":20866,\"start2\":20866,\"length1\":24,\"length2\":18},{\"diffs\":[[0,\".lua\"],[-1,\"\\\nsocket/http.lua\\\nsocket/mbox.lua\\\nsocket/smtp.lua\\\nsocket/tp.lua\\\nsocket/\"],[1,\", http.lua, mbox.lua, smtp.lua, tp.lua, \"],[0,\"url.\"]],\"start1\":20883,\"start2\":20883,\"length1\":78,\"length2\":48},{\"diffs\":[[0,\"``\\\n\\\n\"],[-1,\"Note: \"],[0,\"**No\"]],\"start1\":20936,\"start2\":20936,\"length1\":14,\"length2\":8},{\"diffs\":[[0,\"UDP \"],[-1,\"functionality \"],[0,\"is b\"]],\"start1\":20977,\"start2\":20977,\"length1\":22,\"length2\":8},{\"diffs\":[[0,\"ore`\"],[-1,\" and exposed as a function\"],[0,\".\\\n\\\n*\"]],\"start1\":21024,\"start2\":21024,\"length1\":34,\"length2\":8},{\"diffs\":[[0,\"``\\\n\\\n\"],[-1,\"Or using CSP's shared module prefix:\\\n```lua\\\nlocal socket = require(\\\"shared/socket\\\")  -- explicit pa\"],[1,\"**Evidence from AC log**: CSP creates \"],[0,\"th\"],[1,\"e\"],[0,\" t\"],[-1,\"o extension/internal/lua-shared/socket.lua\\\nlocal udp = socket.udp()\\\n```\\\n\\\n**Evidence**: Grep across the entire AC installation finds zero uses of `require(\\\"socket.udp\\\")` other than our plugin. All other scripts that need socket use `require(\\\"socket\\\")` or `require(\\\"shared/socket\\\")`.\\\n\\\n**The crash cascade**:\\\n1. `require(\\\"socket.udp\\\")` → module not found → error\\\n2. This is at module scope in `telemetry.lua`, so the entire module fails to load\\\n3. `require(\\\"src.telemetry\\\")` in `main.lua` → error propagates\\\n4. `main.lua` never finishes executing → `script.windowMain` is never defined\\\n5. CSP creates the window frame from manifest.ini but has no callback → **blank window**\\\n\\\n**Required fix** in `src/telemetry.lua`:\\\n```lua\\\nlocal socket = require(\\\"socket\\\")\\\nlocal udp = socket.udp()\\\n```\\\n\\\n### 13.3 ac-tracer: Missing `lib/` Directory (Confirmed — NOT a CSP issue)\\\n\\\n**CSP does NOT provide the `lib/` modules that ac-tracer needs.** These are app-local modules specific to ac-tracer.\\\n\\\n**How CSP module resolution works:**\\\n- `require('lib.core.state')` resolves to `<app-dir>/lib/core/state.lua` (relative to the app directory)\\\n- `package.add(dir)` can add additional search roots (documented in CSP SDK at `extension/internal/lua-sdk/ac_apps/README.md`)\\\n- CSP shared modules use `require('shared/...')` prefix → resolves to `extension/internal/lua-shared/`\\\n- ac-tracer does NOT call `package.add()` — it relies on default resolution\\\n\\\n**CSP shared libraries available** (at `extension/internal/lua-shared/`):\\\n\\\n| Category | Modul\"],[1,\"askbar entry for our app (`IMGUI_LUA_ac-telemetry-plugin_main_ICON` on line 484 of log.txt), proving CSP sees the app. But the script silently crashes at `require(\\\"socket.udp\\\")` → no callbacks registered → blank window + no UDP packets.\\\n\\\n**Required fix** in `src/telemetry.lua`:\\\n```lua\\\nlocal socket = require(\\\"socket\\\")\\\nlocal udp = socket.udp()\\\n```\\\n\\\n### 13.3 How to Check if a CSP Lua App is Running\\\n\\\n#### CSP Log Files (Linux/Proton)\\\n\\\nLogs are written to the **Proton prefix**, not the game installation directory:\\\n\\\n```\\\n~/.steam/debian-installation/steamapps/compatdata/244210/pfx/drive_c/users/steamuser/Documents/Assetto Corsa/logs/\\\n├── log.txt                        ← Main AC + CSP log (text, readable)\\\n├── custom_shaders_patch.log       ← Detailed CSP log (binary/UTF-16, not easily grepable)\\\n├── errors.txt                     ← INI reader errors\\\n└── py_log.txt                     ← Python plugin log\\\n```\\\n\\\n**Log evidence from the session:**\\\n- Line 484: `WARNING: TaskBarIcon :: COULD NOT FIND TEXTURES FOR IMGUI_LUA_ac-telemetry-plugin_main_ICON` — CSP sees our app but can't load the icon (Proton texture loading issue)\\\n- Lines 306-329: **ALL app icons fail to load** — not just ours, even built-in ones (AUDIO, CHAT, TELEMETRY, etc.). This is a Proton-wide texture loading issue, not specific to our plugin.\\\n- Line 442: `RemoteTelemetryUDP :: creating socket on port 9996` — AC's built-in UDP works under Proton (good sign for our LuaSocket fix)\\\n- **No Lua error messages** in `log.txt` — Lua errors go to `custom_shaders_patch.log` (binary) or the Lua Debug App\\\n\\\n#### In-Game Debugging Methods\\\n\\\n| Method | How to use | Where output go\"],[0,\"es |\"]],\"start1\":21251,\"start2\":21251,\"length1\":1631,\"length2\":1695},{\"diffs\":[[0,\"---|\"],[1,\"---|\"],[0,\"\\\n| **\"],[-1,\"Socket** (LuaSocket) | `socket`, `socket/smtp`, `socket/http`, `socket/ftp`, `socket/tp`, `socket/url`, `socket/headers` |\\\n| **OpenSSL** | `openssl`, `openssl/ssl`, `openssl/x509/*`, `openssl/ocsp/*`, etc. |\\\n| **Sim helpers** | `sim/traffic`, `sim/cars`, `sim/ai`, `sim/weather`, `sim/chat`, `sim/surfaces`, `sim/ghost`, `sim/motec` |\\\n| **Utils** | `utils/binary`, `utils/steam`, `utils/tts`, `utils/sqlite`, `utils/dbstorage`, `utils/qr`, `utils/obs` |\\\n| **Web** | `web/browser`, `web/ui` |\\\n| **Other** | `ltn12`, `mime`, `math/cubic`, `ui/virtualizing`, `vr/grab`, `dualsense/*` |\\\n\\\n**None of these match** `lib.core.state`, `lib.windows.*`, etc. — those are ac-tracer's own modules that simply weren't included in the distribution.\\\n\\\n### 13.4 Deployment Decision: `apps/lua/` vs `extension/lua/`\\\n\\\n#### Current problem: duplicate copies\\\n\\\nThe plugin exists in TWO locations:\\\n1. **`apps/lua/ac-telemetry-plugin/`** — has `[WINDOW_...]` + `LAZY = FULL` + `script.windowMain`\\\n2. **`extension/lua/ac-telemetry-plugin/`** — has `[SCRIPT]` only, headless\\\n\\\nBoth have `script.update(dt)` → `telemetry.update(dt)` → UDP send. **If both load simultaneously, telemetry is sent twice per frame.**\\\n\\\n#### Comparison\\\n\\\n| Aspect | `apps/lua/` (In-Game App) | `extension/lua/` (Extension) |\\\n|---|---|---|\\\n| **Manifest** | `[ABOUT]` + `[CORE]` + `[WINDOW_...]` | `[ABOUT]` only, or `[ABOUT]` + subsystem sections |\\\n| **App bar** | ✅ Appears in CSP app launcher, user can toggle on/off | ❌ No app bar presence |\\\n| **Window callbacks** | `script.windowMain(dt)` for IMGUI drawing | None — no UI |\\\n| **Loading** | `LAZY = FULL`: loads when opened, unloads when closed | Loaded by subsystem or at startup |\\\n| **User control** | User can enable/disable, drag windows | Runs automatically (selectable in CSP settings for some) |\\\n| **Standard pattern** | CSP's built-in apps use this: CspDebug, AppShelf, Mumble | Tools, game modes, cameras, FFB, PP filters |\\\n| **Subsystem dir** | Flat: `apps/lua/<appname>/` | Categorized: `extension/lua/<category>/<name>/` |\\\n\\\n#### Recommendation: `apps/lua/` (In-Game App)\\\n\\\n**Keep `apps/lua/ac-telemetry-plugin/` and delete the `extension/lua/` copy.** Reasons:\\\n\\\n1. **Visual feedback**: The app window shows the user that telemetry is being sent (\\\"AC Telemetry ●\\\")\\\n2. **User control**: Can be toggled from the app bar — user decides when to start/stop telemetry\\\n3. **Standard pattern**: All CSP apps that users interact with live in `apps/lua/`\\\n4. **Settings support**: `[WINDOW_...]` manifest supports `FUNCTION_SETTINGS` for a settings panel (useful for host/port configuration)\\\n5. **`LAZY = FULL`**: Only runs when needed — doesn't waste resources when closed\\\n6. **The `extension/lua/` copy is misplaced**: It's at the root level (`extension/lua/ac-telemetry-plugin/`), not under a recognized subsystem directory (`tools/`, `new-modes/`, etc.)\\\n\\\n#### Alternative: Headless `extension/lua/` approach\\\n\\\nIf you want telemetry to **always run** without user intervention:\\\n- Place under `extension/lua/tools/ac-telemetry/` (recognized subsystem)\\\n- Use `[ABOUT]` + `[SCRIPT]` manifest\\\n- No window, no app bar icon\\\n- Would run automatically without user needing to click anything\\\n- But: no visual feedback, no settings UI, no way to know it's working\"],[1,\"Lua Debug App** (best) | Open from in-game app launcher (developer section). Already enabled: `APP_LUA_DEBUG=1` in `extension/config/gui.ini` | Shows live `ac.debug()` values, `ac.log()` messages, performance data |\\\n| **`ac.log(message)`** | Add to any Lua script | CSP log file + Lua Debug App log |\\\n| **`ac.debug(key, value)`** | Track live values, optionally with graphs | Lua Debug App (in-game) |\\\n| **`ac.console(message)`** | Print to AC console | In-game console (toggle with backtick/tilde key) |\\\n| **`ac.getLastError()`** | Check if script has thrown errors | Returns string or nil |\\\n| **`ac.warn()`, `ac.error()`** | Log warnings/errors | CSP log + Lua Debug App |\\\n\\\n**Recommended: Add these calls to our plugin for debugging:**\\\n```lua\\\n-- In main.lua, at the top:\\\nac.log(\\\"[ACTelemetry] Script loading...\\\")\\\n\\\n-- In telemetry.lua, after socket creation:\\\nlocal socket = require(\\\"socket\\\")\\\nac.log(\\\"[ACTelemetry] LuaSocket loaded successfully\\\")\\\nlocal udp = socket.udp()\\\nac.log(\\\"[ACTelemetry] UDP socket created\\\")\\\n\\\n-- In telemetry.update(), after successful send:\\\nac.debug(\\\"tx.rate\\\", telemetry.getSendRate(), 0, 120, 60)\\\nac.debug(\\\"tx.packets\\\", telemetry.getPacketCount())\\\nac.debug(\\\"tx.errors\\\", telemetry.getErrorCount())\\\n```\\\n\\\n#### Proton Icon Loading Issue\\\n\\\nThe log shows **every single app icon** fails to load under Proton:\\\n```\\\nWARNING: TaskBarIcon :: COULD NOT FIND TEXTURES FOR AUDIO_ICON\\\nWARNING: TaskBarIcon :: COULD NOT FIND TEXTURES FOR CHAT_ICON\\\nWARNING: TaskBarIcon :: COULD NOT FIND TEXTURES FOR TELEMETRY_ICON\\\n... (30+ icons all fail)\\\n```\\\n\\\nThis is a known Proton/DXVK issue with texture loading from the AC app system. The apps still work — only the sidebar icons are missing. The app window itself should render correctly (ImGui draws are separate from icon textures).\\\n\\\n### 13.4 Should We Have Two Variants (App + Extension)?\\\n\\\n**No. One variant, deployed as an app.**\\\n\\\nReasons against maintaining two variants:\\\n\\\n1. **Double-loading risk**: If both `apps/lua/` and `extension/lua/` copies exist, CSP loads both → **double UDP transmission** (120 packets/sec instead of 60)\\\n\\\n2. **Code divergence**: The app variant has different `manifest.ini` and `main.lua`. Maintaining two sets of files for the same plugin creates confusion about which is \\\"current\\\"\\\n\\\n3. **Extension is misplaced**: The `extension/lua/` copy sits at the root level, not under a recognized subsystem directory. CSP might not even load it correctly as an extension.\\\n\\\n4. **No benefit to the extension variant**: The app variant with `LAZY = FULL` already gives you the best of both worlds:\\\n   - **When the app window is closed**: The script unloads completely (same as not having it)\\\n   - **When the app window is open**: Telemetry runs with visual feedback\\\n   - If you want always-on telemetry, just leave the app window open (it's tiny: 160×30 px)\\\n\\\n5. **Future settings panel**: Only the app variant supports `FUNCTION_SETTINGS` for an in-game configuration UI (host/port). The extension variant has no UI at all.\\\n\\\n**Decision**: Maintain only the app variant in git. Delete the extension/lua copy. Deploy from project source to `apps/lua/` only.\"],[0,\"\\\n\\\n##\"]],\"start1\":22952,\"start2\":22952,\"length1\":3267,\"length2\":3142},{\"diffs\":[[0,\"- **\"],[-1,\"ImGui rendering**: CSP uses Dear ImGui for all Lua UI. Under Proton, ImGui rendering goes through WineD3D/DXVK — g\"],[1,\"App icons don't load**: Confirmed from log — all app icons fail under Proton. Apps still work, only sidebar icons are missing.\\\n- **ImGui r\"],[0,\"en\"],[1,\"d\"],[0,\"er\"],[-1,\"ally works well but can have edge cases wi\"],[1,\"ing itself works**: AC's built-in apps (CspDebug, AppShelf) use \"],[0,\"th\"],[1,\"e\"],[0,\" s\"],[-1,\"pecific DXVK versions\"],[1,\"ame ImGui system and function correctly\"],[0,\".\\\n\\\n*\"]],\"start1\":26674,\"start2\":26674,\"length1\":193,\"length2\":259},{\"diffs\":[[0,\" 1, \"],[-1,\"these are\"],[1,\"rendering is\"],[0,\" not\"]],\"start1\":26943,\"start2\":26943,\"length1\":17,\"length2\":20},{\"diffs\":[[0,\"f it\"],[1,\"'s\"],[0,\" still \"],[-1,\"appears \"],[0,\"blan\"]],\"start1\":27069,\"start2\":27069,\"length1\":23,\"length2\":17},{\"diffs\":[[0,\" fix\"],[-1,\", then investigate Proton rendering\"],[0,\":\\\n1.\"]],\"start1\":27097,\"start2\":27097,\"length1\":43,\"length2\":8},{\"diffs\":[[0,\"king\"],[-1,\"\\\n4. Check DXVK version (`dxvk --version`)\"],[0,\"\\\n\\\n##\"]],\"start1\":27239,\"start2\":27239,\"length1\":49,\"length2\":8},{\"diffs\":[[0,\"d.\\\n\\\n\"],[-1,\"#### Option C: CSP INI Settings (Alternative)\\\n\\\nUse `[SETTINGS_MYSETTING]` in manifest.ini for sliders/inputs that CSP renders natively. Simpler than custom settings window but less flexible.\\\n\\\n\"],[0,\"####\"]],\"start1\":28419,\"start2\":28419,\"length1\":200,\"length2\":8},{\"diffs\":[[0,\"CSP \"],[-1,\"architecture\"],[1,\"log analysis, deployment paths\"],[0,\" doc\"]],\"start1\":32112,\"start2\":32112,\"length1\":20,\"length2\":38},{\"diffs\":[[0,\"cket.udp()`*\"],[1,\"\\\n*Cleanup needed: Delete `extension/lua/ac-telemetry-plugin/`, merge app variant into git*\"]],\"start1\":32227,\"start2\":32227,\"length1\":12,\"length2\":102}]"
metadata_diff: {"new":{},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2026-06-03T07:07:52.697Z
created_time: 2026-06-03T07:07:52.697Z
type_: 13