L1 Physics Engine Duplicate Declarations and Telemetry Formatting Fix#308
L1 Physics Engine Duplicate Declarations and Telemetry Formatting Fix#308dcplatforms wants to merge 1 commit into
Conversation
Consolidates duplicate `safeFloat` and `handleDerAlarm` function declarations. Splits utility into `safeFloat` (returns Number) and `safeFloatFormatted` (returns string). Fixes `alertSiteId` parsing for site locks. Cleans up duplicate module exports. Co-authored-by: dcplatforms <10982057+dcplatforms@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Consolidates duplicate declarations of
safeFloatandhandleDerAlarminsideservices/01-physics-engine/index.jsto fix SyntaxErrors and type discrepancies, resulting in 55/55 passing tests.PR created automatically by Jules for task 7254241289795422837 started by @dcplatforms
Note
Medium Risk
Touches safety-lock activation on DER alarms and how physics/confidence scores are typed in alerts; behavior is mostly clarified but alarm input shape and score formatting paths changed.
Overview
Fixes duplicate
safeFloatandhandleDerAlarmdeclarations in the L1 physics engine that caused parse/syntax errors and inconsistent exports.Telemetry helpers:
safeFloatnow returns a numeric float for Redis/site load math; a newsafeFloatFormattedowns four-decimal string scores forcalculateConfidenceScore,calculatePhysicsMetadata, and Kafka alert payloads. Tests were updated to assert formatting onsafeFloatFormattedand parsing onsafeFloat.DER alarms: A single
handleDerAlarmaccepts either a parsed object or a Kafka-style message (input.value), normalizesalarmType/alarm_typeand site id, and sets the site safety lock for CRITICAL/HIGH only.Alerts: Physics alert site resolution prefers top-level payload keys, then
metadata. Module exports drop duplicate entries and exportsafeFloatFormatted.Reviewed by Cursor Bugbot for commit ccbe236. Configure here.