diff --git a/docs/superpowers/plans/2026-08-05-movementtest-osqp-iteration-limit.md b/docs/superpowers/plans/2026-08-05-movementtest-osqp-iteration-limit.md new file mode 100644 index 0000000..b5cdf64 --- /dev/null +++ b/docs/superpowers/plans/2026-08-05-movementtest-osqp-iteration-limit.md @@ -0,0 +1,111 @@ +# MovementTest OSQP Iteration Limit 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:** Expose a 12000-iteration OSQP cap for observation-only MovementTest sessions. + +**Architecture:** TrajectoryObservationSettings owns an integer iteration limit, snapshots and validates it. The public MovementTest field maps into those settings, and the observation controller maps it into the session-local EM solver configuration. Production EM defaults remain unchanged. + +**Tech Stack:** C# 10, .NET, EMPlannerVerificationHost. + +## Global Constraints + +- Default MaximumOsqpIterations is exactly 12000. +- SolverTimeoutSeconds remains at its existing 0.50d MovementTest default. +- AbsoluteTolerance, RelativeTolerance, and StrictResidualTolerance remain 1e-5d. +- Do not change production EM defaults, vehicle/map constraints, or observe-only command behavior. + +--- + +### Task 1: Propagate the test iteration limit into an EM request + +**Files:** + +- Modify: ClumsyPilot/tests/EMPlannerVerificationHost/TrajectoryObservationChecks.cs:95-176,384-416 +- Modify: ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationContracts.cs:9-50 +- Modify: ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/MovementTest.TrajectoryObservationTest.cs:25-71 +- Modify: ClumsyPilot/ParkrobTrajplanner/tarjplanner_movementtest/TrajectoryObservationPipeline.cs:198-215 + +**Interfaces:** + +- Consumes: TrajectoryObservationSettings.CreateValidatedSnapshot() and TrajectoryObservationController.StartCycle(...). +- Produces: TrajectoryObservationSettings.MaximumOsqpIterations, copied to EmPlanningRequest.Configuration.Solver.MaximumOsqpIterations. + +- [ ] **Step 1: Write the failing test** + +Add assertions proving the public field uses the default and a custom setting reaches the request: + +~~~csharp +Verification.True(source.Contains("public int MaximumOsqpIterations = 12000;"), + "observer MovementTest exposes the test OSQP iteration default"); + +var settings = new TrajectoryObservationSettings +{ + MaximumOsqpIterations = 9000, +}; +// Start one controller cycle. +Verification.Equal(9000, planningService.Requests[0].Configuration.Solver.MaximumOsqpIterations, + "observer configured OSQP iteration limit"); +~~~ + +Assert 0 and negative iteration limits are rejected. + +- [ ] **Step 2: Run focused verification to verify it fails** + +Run: + +~~~powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +~~~ + +Expected: FAIL because MaximumOsqpIterations is absent. + +- [ ] **Step 3: Write the minimal implementation** + +Add this setting and snapshot mapping: + +~~~csharp +public int MaximumOsqpIterations { get; set; } = 12000; +~~~ + +Validate it with: + +~~~csharp +if (MaximumOsqpIterations <= 0) + throw new ArgumentOutOfRangeException(nameof(MaximumOsqpIterations), "Value must be positive."); +~~~ + +Map it into the MovementTest settings and session configuration: + +~~~csharp +configuration.Solver.MaximumOsqpIterations = settings.MaximumOsqpIterations; +~~~ + +- [ ] **Step 4: Run focused verification to verify it passes** + +Run: + +~~~powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- trajectory-observation +~~~ + +Expected: PASS trajectory-observation. + +- [ ] **Step 5: Run full regression and build** + +Run: + +~~~powershell +dotnet run --project ClumsyPilot/tests/EMPlannerVerificationHost/EMPlannerVerificationHost.csproj -- em-all +dotnet build ClumsyPilot/ClumsyPilot.csproj --no-restore +~~~ + +Expected: all suites pass and the build reports zero errors. + +- [ ] **Step 6: Commit 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 OSQP iterations" +~~~ +