Просмотр исходного кода

fix(host): close staticcheck unused fields and RTL SDK Python grpc selection

Drop the unused commandedTargets wrapper and pendingSafe peerInternal flag, and pick an SDK interpreter that actually has grpcio so production UART RTL can EnterSafe/Resume.

Co-authored-by: Cursor <cursoragent@cursor.com>
root 3 месяцев назад
Родитель
Сommit
c5db97507b
3 измененных файлов с 26 добавлено и 24 удалено
  1. 0 7
      internal/device/device.go
  2. 13 14
      internal/device/serial_worker.go
  3. 13 3
      tools/rtl_uart_cosim/run_hthd_pty_rtl.py

+ 0 - 7
internal/device/device.go

@@ -1588,13 +1588,6 @@ func overlaySafetyDefaults(c *hthv1.Capabilities, contract safety.EffectiveContr
 	return c
 }
 
-func (d *Device) commandedTargets() []*hthv1.CommandedActuator {
-	if !d.haveCont || !d.baselineReady {
-		return nil
-	}
-	return d.commandedTargetsAt(d.store.Epoch())
-}
-
 func (d *Device) commandedTargetsAt(epoch uint64) []*hthv1.CommandedActuator {
 	if !d.haveCont || !d.baselineReady {
 		return nil

+ 13 - 14
internal/device/serial_worker.go

@@ -165,20 +165,19 @@ type pendingResumeState struct {
 }
 
 type pendingSafeState struct {
-	commandID    string
-	reason       string
-	origin       string
-	peerUID      int32
-	peerGID      int32
-	peerPID      int32
-	enqueued     time.Time
-	deadline     time.Time
-	epoch        uint64
-	requestedAt  time.Time
-	attempts     int
-	maxAttempts  int
-	nextRetry    time.Time
-	peerInternal bool
+	commandID   string
+	reason      string
+	origin      string
+	peerUID     int32
+	peerGID     int32
+	peerPID     int32
+	enqueued    time.Time
+	deadline    time.Time
+	epoch       uint64
+	requestedAt time.Time
+	attempts    int
+	maxAttempts int
+	nextRetry   time.Time
 }
 
 const safeNotStartedRetry = 50 * time.Millisecond

+ 13 - 3
tools/rtl_uart_cosim/run_hthd_pty_rtl.py

@@ -87,13 +87,23 @@ def _select_cocotb_python() -> Path | None:
 
 
 def _sdk_python() -> Path:
-    for cand in (
+    cands = [
         Path(os.environ.get("HTH_SDK_PYTHON", "")),
         HOST / ".venv-sdk" / "bin" / "python3",
+        HOST / ".venv-sdk" / "bin" / "python",
+        Path("/opt/python-3.12/bin/python3.12"),
         Path("/usr/bin/python3.13"),
         Path(sys.executable),
-    ):
-        if cand.is_file():
+    ]
+    for cand in cands:
+        if not cand.is_file():
+            continue
+        r = subprocess.run(
+            [str(cand), "-c", "import grpc"],
+            stdout=subprocess.DEVNULL,
+            stderr=subprocess.DEVNULL,
+        )
+        if r.returncode == 0:
             return cand
     return Path(sys.executable)