From 6cc24735ba1dba19b564a3efc382862721436ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E8=96=84=E4=BA=91?= Date: Wed, 5 Aug 2026 11:36:01 +0800 Subject: [PATCH] docs: plan MovementTest solver timeout --- .../2026-08-05-movementtest-solver-timeout.md | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 docs/superpowers/plans/2026-08-05-movementtest-solver-timeout.md diff --git a/docs/superpowers/plans/2026-08-05-movementtest-solver-timeout.md b/docs/superpowers/plans/2026-08-05-movementtest-solver-timeout.md new file mode 100644 index 0000000..7df9e9e --- /dev/null +++ b/docs/superpowers/plans/2026-08-05-movementtest-solver-timeout.md @@ -0,0 +1,103 @@ +# MovementTest Solver Timeout Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Make the observation-only MovementTest expose a 0.50-second default OSQP time budget without relaxing solver accuracy. + +**Architecture:** `TrajectoryObservationSettings` owns the test-facing time-budget value and validates/copies it. The MovementTest maps its public field into those settings, and `TrajectoryObservationController` maps the snapshot into the per-session EM configuration. The production EM defaults remain unchanged. + +**Tech Stack:** C# 10, .NET, existing EMPlannerVerificationHost test host. + +## Global Constraints + +- Default test solver timeout is exactly `0.50d` seconds. +- `AbsoluteTolerance`, `RelativeTolerance`, and `StrictResidualTolerance` remain `1e-5d`. +- Do not change vehicle constraints, map construction, speed limits, or observe-only command behavior. +- Do not alter `EmPlannerConfiguration.CreateDefault()`; the override belongs only to the observation test. + +--- + +### Task 1: Propagate the test solver budget into an EM request + +**Files:** + +- Modify: `ClumsyPilot/tests/EMPlannerVerificationHost/TrajectoryObservationChecks.cs:122-170,384-405` +- Modify: `ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationContracts.cs:9-49` +- Modify: `ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/MovementTest.TrajectoryObservationTest.cs:25-70` +- Modify: `ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationPipeline.cs:198-214` + +**Interfaces:** + +- Consumes: `TrajectoryObservationSettings.CreateValidatedSnapshot()` and `TrajectoryObservationController.StartCycle(...)`. +- Produces: `TrajectoryObservationSettings.SolverTimeoutSeconds`, copied to `EmPlanningRequest.Configuration.Scheduling.SolverTimeoutSeconds`. + +- [ ] **Step 1: Write the failing test** + +In `VerifiesControllerBuildsSegmentZeroRequest`, set a non-default observation setting and assert it reaches the request: + +```csharp +var settings = new TrajectoryObservationSettings +{ + SolverTimeoutSeconds = 0.42d, +}; +// Start one controller cycle. +Verification.NearlyEqual(0.42d, planningService.Requests[0].Configuration.Scheduling.SolverTimeoutSeconds, + "observer configured solver timeout"); +``` + +Also extend `VerifiesSettingsSnapshotAndVehicle` to assert that a default snapshot retains `0.50d`, and extend `RejectsInvalidSettings` with `settings => settings.SolverTimeoutSeconds = 0d`. + +- [ ] **Step 2: Run the focused verification to verify it fails** + +Run: + +```powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +``` + +Expected: FAIL because `SolverTimeoutSeconds` does not yet exist or its value is not propagated to the request. + +- [ ] **Step 3: Write the minimal implementation** + +Add and copy/validate the settings property: + +```csharp +public double SolverTimeoutSeconds { get; set; } = 0.50d; +``` + +Map it from the public MovementTest field, then set the session-local EM configuration: + +```csharp +configuration.Scheduling.SolverTimeoutSeconds = settings.SolverTimeoutSeconds; +``` + +Do not alter the EM default configuration or any tolerance property. + +- [ ] **Step 4: Run focused verification to verify it passes** + +Run: + +```powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +``` + +Expected: all trajectory-observation checks pass, including timeout propagation and invalid-setting rejection. + +- [ ] **Step 5: Run the related EM regression suite** + +Run: + +```powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- em-all +dotnet build ClumsyPilot/ClumsyPilot.csproj --no-restore +``` + +Expected: both commands finish successfully with no errors. + +- [ ] **Step 6: Commit the implementation** + +```powershell +git add ClumsyPilot/tests/EMPlannerVerificationHost/TrajectoryObservationChecks.cs ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationContracts.cs ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/MovementTest.TrajectoryObservationTest.cs ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationPipeline.cs +git commit -m "feat: configure MovementTest solver timeout" +``` +