Open Questions [TEAM_WHY_NEEDED] & Tech Debt
Use this board during engineering/product reviews to record the historical “Why?” behind non-obvious rules and track cleanup priorities.
A. Open [TEAM_WHY_NEEDED] Questions for the Team
- Unlocked OTP in online manufacturing CLI:
tools/provision_device.py:263unconditionally passes--allow-unlocked-otp(markedLAB ONLYinprovision_otp.py) and never passes--permissions-file. Is OTP locking deferred for current production batches? - Legacy magic numbers in active OTP/signing tools:
tools/provision_otp.py:32-33burns0x41534C44(ASLD) instead of0x504C4E56(PLNV), andsign_firmware.pyemits0x41534C46(ASLF). When should new hardware batches switch toPLNV? - Ephemeral signing fallback in Docker builder & dev default in provisioning CLI:
tools/build_firmware_docker.sh:21-61silently generates temporary CA/signing keys in/tmp/if production files are missing;tools/provision_device.py:28defaults tohttps://dev-cloud.planovi.app/api/v1. Should release builds fail closed? - Unauthenticated FastAPI management API & dead Flutter
AuthService: All 35 management routes (converters.pyincluding Device CA signing,settings.py,activity_logs.py,firmware.py) have zero FastAPI auth, andadmin/lib/services/auth_service.dartis an unused mock with Supabase Auth TODOs. Is Nginx IP allowlisting / Cloudflare Access the intended sole boundary, or is JWT auth planned? - ORM vs SQL migration drift (
edge_system_settings&telemetry_ingest_receipts): Wereedge_system_settingsand the 4 UUID/audit columns ontelemetry_ingest_receiptscreated manually in Supabase outsidecloud/migrations/000..019? Should a reconciliation migration020be added? - Supabase Edge pass-through vs migration
019RPC:supabase/functions/ingest-telemetry/index.tsproxies raw telemetry to FastAPI/edge-recordwithout touching PostgreSQL, while migration019maintainspublic.ingest_telemetry_record()in Supabase. Which ingestion path is canonical in production? - Unexposed
VirtualMeterServicerecovery APIs:register_point_zero()andhandle_meter_replacement()exist with full validation invirtual_meter_service.pybut have zero API endpoints. How do operators currently handle physical meter replacements when counter rollbacks are rejected? - Serial floor
130, synthetic USB slot metadata & divergent offline thresholds: Why doesconverters.py:316,918enforcemax_num = 130, why doesprepare-usb-provisioningreturn hardcoded synthetic Slot B block/size metadata, and should the three offline thresholds (180 sUI /300 salert /900 srecovery log) be unified? - Firmware RS-485 & measurement edge cases: Confirm (a) fixed 8N1 parity (
uart_rs485.c:32), (b)bus_scanner.cmappingbaudrate=0 -> 9600instead of multi-baud sweep, (c) LEM-60 reading 36 regs while decoding 18 (meter_lem60.c:43), (d) unbounded per-phaseP/Qand asymmetric current cap (1M Ascanner vs100k Amanager), (e)device_event.cmin timestamp 2000 vs 2020 intime_sync.c. - Firmware NVS/Button/OTA/Storage edge cases: Confirm (a) 168 KiB unused NVS gap (
flash_layout.h), (b) 3–10 s button dead zone (button.c), (c) factory reset leaving prior encrypted NVS slot unerased (config_store.c:937-950), (d) unlimited backward jump on localtime_sync_set_utc()causing RAM monotonic hold, (e)quarantine_allowance = 64cap (sd_journal.c:1292), (f)ota_updatecommand returning"APPLIED"stub instead of"FAILED", (g) vestigial HTTPS->MQTT fallback removal, (h)src/ux/index.htmlomitting Wi-Fi SSID scan andreplayaction. - Admin UI hardcoded placeholders:
ConverterDetailScreen:2087displays static"Bus Channel 0 · Baud 9600 · 0 CRC Errors"and:1202hardcodes'HTTPS Standalone mTLS (:443)';DashboardScreenignoresAdminSettings.refreshRateSec. Should these be wired to real API fields? - Infrastructure & tooling quirks: Confirm (a) hardcoded
extra_hosts -> 191.218.165.149and conflictingPLANOVI_TRUSTED_PROXY_CIDRSvsASLANDI_TRUSTED_PROXY_CIDRSdefaults indeploy/docker-compose.public-ingress.yml, (b) pinningFreeRTOS-Kernelindeploy/Dockerfile.firmware-builderinstead of-b main, (c) making Windows Norton CA export optional intools/setup_local_staging.py, (d) archiving/removingmockups/planovi-converters/.
B. Confirmed Runtime Bugs & Security Vulnerabilities
- BUG (500 Crash):
PATCH /api/v1/converter-orders/{order_id}(cloud/api/converters.py:126-130, 635-648) reads nonexistentpayload.converter_serialandpayload.notesonConverterOrderUpdateRequest. - BUG (Silent Feature Disable):
AlertDispatcher(cloud/services/alert_dispatcher.py:203) ignoresPLANOVI_GOOGLE_CHAT_WEBHOOK_URL(reads onlyASLANDI_GOOGLE_CHAT_WEBHOOK_URL), silently disabling both Google Chat alerts andreconcile_converter_availabilityoffline detection. - BUG (Env Var Ignored):
cloud/mqtt_ingress.py:107reads onlyASLANDI_MQTT_INGRESS_CLIENT_ID, ignoringPLANOVI_MQTT_INGRESS_CLIENT_ID. - BUG (Migration vs ORM Breakage):
SystemSetting(edge_system_settings) vs016(system_settings);TelemetryIngestReceiptmaps 4 columns (id,created_at,updated_at,created_by) missing from000–019;telemetry_data.source_sequencelostNOT NULLin008;alert_notificationsretries indefinitely past DB checkattempt_count <= 100. - BUG (Scratch Register Overwrite):
src/main.c:414-417writesPLANOVI_FAULT_OTA_TRIAL_TIMEOUTtowatchdog_hw->scratch[0], thenwatchdog_mgr_reboot(false)(src/hal/watchdog.c:88) overwritesscratch[0] = RESET_REASON_SOFTWARE. - BUG (Chunked HTTP Broken on
sync/storage):https_telemetry_transport.c:92-105copies raw undecoded body intoresponse_body, breaking JSON parsing if upstream usesTransfer-Encoding: chunked. - BUG (Synchronous PBKDF2 in
tcpip_thread):POST /api/auth/account(api_endpoints.c:557-578,auth.c:953-992) executes 100k PBKDF2 iterations synchronously inside lwIP callback. - BUG (49.7-Day Tick Wraparound):
cloud_client.c:1960, 1965use unsignednow >= deadlinecomparisons instead of signed wrap-safe subtraction. - BUG (Dashboard Cloud Transport Mismatch):
GET /api/status(api_endpoints.c:1869-1878) omitscloud.transport, andsrc/ux/index.html:1886teststransport === 1for HTTPS (actually2). - BUG (Status & Diagnostics):
cloud/api/status.py:133-140never resetssupabase-dbback to"online";cloud/app.py:150-154/statusbypasses DI;converters.py:2046queries nonexistent receipt outcome'DUPLICATE';telemetry_ingress.py:246-254_check_sync_requiredomitsdesired_cloud_port;retention_service.py:31-32ignores year multiplier;converters.py:1598hardcodes UTC+2 instead ofEurope/Warsaw;converters.py:1301signs cert with unstrippedserial_number;staging/verify_schema.py:10-12skips+asyncpgstrip forPLANOVI_DATABASE_URL. - BUG (Flutter I18n & UX): 5 missing keys (
chart_legend_pv,chart_legend_cons,th_time,modal_close,no_components_found) render raw in UI;ActivityLogScreenhas no search debounce;event_ingestion.pyoverwrites originaldetails["message"]upon RS-485 resolution. - SECURITY: Path traversal risk in
POST /api/v1/firmware/upload(firmware.py:268-271);verify_forwarded_client_certificate(telemetry_ingress.py:49-85) skips cert expiration check;POST /api/auth/password-status(auth.c:910-932) lacks IP binding & TTL; hardcoded secret fallbacks inmtls_gateway.py:40,status.py:15,deploy/check-health.sh:13,deploy/cron-setup.md:34;status.pyuses non-constant-time!=; FlutterApiServicelogs full response bodies (including provisionedaes_key_hex/private keys) in browser console viaLogInterceptor(responseBody: true);deploy/nginx.admin.planovi.conf:30has placeholderallow 1.2.3.4;; FastAPI CORS defaults to["*"]withallow_credentials=True.
C. Dead / Legacy Code & Discrepancies Checklist
- Legacy
ASLANDI_*Artifacts: Magic bytes (ASLF,ASBT,ASLD,ASLC,0xA51A0000), CMake aliases (aslandi_release, etc.), env var aliases (ASLANDI_*), Docker outputaslandi_full_factory.uf2, advisory lock0x41534C414E4449, MQTT client ID"aslandi-cloud-ingress". - Unwired / Dead Modules & Functions:
- Firmware:
ota_update.c(ota_start/write_chunk/finish_and_verify/apply_and_reboot/abort/get_progress),bootloader_mark_slot_valid(),BOOT_VERIFY_ERR_SIZE/NOT_VALIDATED,BUTTON_EVENT_SHORT_CLICKhandler,meter_manager_process(),energy_counter_delta(),lem60_context_t/chint666_context_t,modbus_rtu_write_*_register(s),sd_card_erase_sector(),FIFO_WRITER_SAVE_METADATA,cloud_retry_fallback_allowed(),g_sta_consecutive_failures,active_netif,PLANOVI_COLOR_*RGB LED constants. - Cloud & Supabase:
cloud/services/device_provisioning.py(entire file),email-templates/*.html(all 4 files),supabase/functions/ingest-telemetry/schema3_adapter.ts:mapSchema3ToRawTelemetry,virtual_meter_service.py:{register_point_zero,handle_meter_replacement,get_accumulated_virtual_energy},ConverterUpdateRequest.{clear_company,clear_building},status._check_tcp_port. - Flutter Admin:
AuthService,sampleConverters,ApiService.{fetchFacilities,createConverter,uploadFirmwareRelease},window.requestPicoUsbDevice(admin/web/index.html),google_fontsdependency,76unused i18n keys. - Tests & Mockups:
tests/test_fifo_buffer.c(excluded fromtests/CMakeLists.txt),mockups/planovi-converters/(legacy static mockup + unused Next.js/Vinext scaffold).
- Firmware:
- Outdated Comments / Docs:
image_header.h:78("RP2350-PICO2W"vs"PICO2W-RP2350"),crypto_aes.h(“Hardware-Accelerated AES-256” vs software mbedTLS),modbus_rtu.h:9,158(FC 0x16vs0x10),schema3_adapter.ts:19-20(mt/mrmeanings contradict migration019),mqtt_broker_config.conf:72(“1MB” vs4096),cloud/migrations/README.md(stops at014),admin/README.md&admin/pubspec.yaml(still call app a static mockup),src/ux/index.html:962,1190(mentions “testów T04” and says factory reset wipes telemetry queue).