Skip to content

Pin Windows diagnostic command contracts (W-D1h–W-D4h: cross-platform mirror of Linux D-section)

Placeholder ppxd requested to merge phase12.M.W.D-windows-diagnostic-commands into main

Summary

  • Closes the Windows diagnostic command gap identified in the global audit. Mirrors Linux Section D (D1h–D4h) so operators on mixed Windows + Linux fleets running the same documented debug recipe see identical behaviour.
  • 4 new tests: W-D1h (show-thumbprint round-trip), W-D2h (list-instances), W-D3h (show-config round-trip), W-D4h (new-certificate idempotency).
  • Plus a defensive WindowsTentacleHostStateCollection (mirrors LinuxTentacleHostStateCollection) — serializes the 4 test classes that share %ProgramData%\Squid Tentacle\instances.json to prevent the parallel-execution race surfaced by first runner.

What this pins

Test Pin
W-D1h show-thumbprint stdout matches register's payload thumbprint (round-trip identity contract)
W-D2h list-instances shows all created instances + label headers (operator grep contract)
W-D3h show-config returns persisted values + 'Detected Mode: Listening' + no cert-error fallback
W-D4h new-certificate is load-or-create (NOT rotation despite name) — second call returns same thumbprint

Why this matters

Operators debugging a failed-to-poll agent run show-thumbprint / show-config / list-instances — the documented debug recipe. If any layer of the round-trip drifts on Windows but not Linux (or vice versa), the cross-OS ops runbook silently lies for one platform. These pins close that gap.

First-runner discoveries

  1. Empty CertsPath crash in ShowThumbprintCommand: same Linux D4h iter 1 issue. Root cause: Program.cs's outer AddJsonFile(instanceConfigPath) is what makes Tentacle:CertsPath available to read-only commands. In-process tests need to mirror that composition. Added BuildConfigurationLikeProgramCs helper.
  2. Parallel-execution race on instances.json: when diagnostic tests' registry.Add/Remove ran concurrently with register tests, register's pre-created entry got stomped. Fixed via WindowsTentacleHostStateCollection serializing all 4 register-touching test classes.

Test plan

  • dotnet build green
  • Verified locally on macOS dev box: 14/14 (10 register + 4 diagnostic) green when run together
  • CI tentacle-windows-e2e workflow passes all 4 new W-D* tests + existing 88 tests still pass

🤖 Generated with Claude Code

Merge request reports

Loading