Add Move proof activation surface
This commit is contained in:
parent
4a968319ac
commit
32bf6fa518
7 changed files with 190 additions and 14 deletions
|
|
@ -121,6 +121,14 @@ a named invariant that the native runtime cannot protect yet.
|
|||
in-process provider and proves config activation can produce the same named
|
||||
proof chain. Real Nightwing/Starfire cross-process ring opening remains
|
||||
pending.
|
||||
- `mimir.move_proof_runtime_activation.v1` is the typed readiness/proof-spine
|
||||
surface for configured Move proof sources. It reports the configured stream,
|
||||
provider kind, active/driver state, native reservoir path, calibrated camera
|
||||
ids, latest same-stream proof ids, latest verdict, and the unavailable
|
||||
default-provider diagnostic. `Mimir.BufferSmoke
|
||||
--move-proof-runtime-activation-surface-smoke` proves both an active injected
|
||||
ring document and the inactive default runtime document without claiming live
|
||||
field evidence.
|
||||
- `MimirMoveProofDevSurface` is a dev-only bootstrap gated by
|
||||
`MIMIR_MOVE_PROOF_DEV_SURFACE`. It uses the same runtime proof attachment so
|
||||
`Mimir.BufferSmoke --move-proof-presented-frame-smoke` can run `Mimir.App`
|
||||
|
|
|
|||
|
|
@ -239,6 +239,14 @@ explicitly because the current C# CultMesh ring is still in-process only;
|
|||
`Mimir.BufferSmoke --move-proof-runtime-activation-smoke` injects an in-process
|
||||
provider to prove the activation path without claiming live Nightwing field
|
||||
evidence.
|
||||
`mimir.move_proof_runtime_activation.v1` is the typed readiness/proof-spine
|
||||
surface for configured Move proof sources. It reports the configured evidence
|
||||
stream, provider kind, active/driver state, native reservoir path, calibrated
|
||||
camera ids, latest same-stream proof ids, latest verdict, and the inactive
|
||||
diagnostic when the default runtime lacks a live cross-process CultMesh ring
|
||||
opener. `Mimir.BufferSmoke --move-proof-runtime-activation-surface-smoke`
|
||||
proves both the active injected-ring document and the unavailable default
|
||||
document; this is readiness/proof observation, not field evidence.
|
||||
`MimirMoveProofDevSurface` is a dev-only bootstrap gated by
|
||||
`MIMIR_MOVE_PROOF_DEV_SURFACE`. It publishes a synthetic calibrated proof
|
||||
surface through the same `MimirRuntime.PublishMoveProofSurface` attachment so
|
||||
|
|
|
|||
|
|
@ -173,7 +173,16 @@ if (args.Any(arg => string.Equals(arg, "--move-proof-runtime-activation-smoke",
|
|||
{
|
||||
return RunMoveProofRuntimeDriverSmoke(
|
||||
ParseStringOption(args, "--native-reservoir", DefaultNativeReservoirPath()),
|
||||
activateViaConfiguredSource: true);
|
||||
activateViaConfiguredSource: true,
|
||||
requireActivationSurface: false);
|
||||
}
|
||||
|
||||
if (args.Any(arg => string.Equals(arg, "--move-proof-runtime-activation-surface-smoke", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
return RunMoveProofRuntimeDriverSmoke(
|
||||
ParseStringOption(args, "--native-reservoir", DefaultNativeReservoirPath()),
|
||||
activateViaConfiguredSource: true,
|
||||
requireActivationSurface: true);
|
||||
}
|
||||
|
||||
if (args.Any(arg => string.Equals(arg, "--move-proof-presented-frame-smoke", StringComparison.OrdinalIgnoreCase)))
|
||||
|
|
@ -2285,7 +2294,10 @@ static int RunMoveProofRuntimeFrameSmoke()
|
|||
: 1;
|
||||
}
|
||||
|
||||
static int RunMoveProofRuntimeDriverSmoke(string nativeReservoirPath, bool activateViaConfiguredSource)
|
||||
static int RunMoveProofRuntimeDriverSmoke(
|
||||
string nativeReservoirPath,
|
||||
bool activateViaConfiguredSource,
|
||||
bool requireActivationSurface = false)
|
||||
{
|
||||
if (!File.Exists(nativeReservoirPath))
|
||||
{
|
||||
|
|
@ -2452,12 +2464,52 @@ static int RunMoveProofRuntimeDriverSmoke(string nativeReservoirPath, bool activ
|
|||
var activationStatus = runtime.MoveProofActivationStatuses.LastOrDefault(status =>
|
||||
string.Equals(status.EvidenceStreamId, streamId, StringComparison.Ordinal));
|
||||
var activationOk = !activateViaConfiguredSource || activationStatus?.Active == true;
|
||||
var activationDocuments = runtime.CreateMoveProofRuntimeActivationDocuments(1_781_202_600_006_000_000);
|
||||
var activationDocument = activationDocuments.SingleOrDefault(document =>
|
||||
string.Equals(document.EvidenceStreamId, streamId, StringComparison.Ordinal));
|
||||
var activationSurfaceOk = !requireActivationSurface || activationDocument is
|
||||
{
|
||||
Active: true,
|
||||
DriverRegistered: true,
|
||||
LatestProofId: "mimir:starfire:move-proof:79",
|
||||
LatestMuninnEvidenceFrameId: "muninn:nightwing:move-evidence:79",
|
||||
LatestMimirEvidenceFrameId: "mimir:starfire:move-evidence:79",
|
||||
LatestMimirPoseFrameId: "mimir:starfire:move-pose:79",
|
||||
LatestFensalirFrameId: "fensalir:starfire:presented-frame:79",
|
||||
LatestVerdict: MimirMoveProofVerdict.FullPose,
|
||||
CalibratedCameraCount: 2
|
||||
};
|
||||
|
||||
MimirMoveProofRuntimeActivationDocument? unavailableDocument = null;
|
||||
if (requireActivationSurface)
|
||||
{
|
||||
using var unavailableRuntime = new MimirRuntime(
|
||||
new AquariumRuntimeOptions(Headless: true, CultCachePath: ""),
|
||||
new MimirRuntimeConfiguration
|
||||
{
|
||||
Settings = new MimirSynchronizationSettings(),
|
||||
MoveProofSources = [configuration],
|
||||
});
|
||||
unavailableRuntime.OnSceneReady();
|
||||
unavailableDocument = unavailableRuntime
|
||||
.CreateMoveProofRuntimeActivationDocuments(1_781_202_600_007_000_000)
|
||||
.SingleOrDefault(document => string.Equals(document.EvidenceStreamId, streamId, StringComparison.Ordinal));
|
||||
activationSurfaceOk = activationSurfaceOk &&
|
||||
unavailableDocument is
|
||||
{
|
||||
Active: false,
|
||||
DriverRegistered: false,
|
||||
LatestProofId: "",
|
||||
} &&
|
||||
unavailableDocument.Diagnostic.Contains("No live CultMesh shared-memory ring opener", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
Console.WriteLine(
|
||||
$"move-proof-runtime-{(activateViaConfiguredSource ? "activation" : "driver")}-smoke proof={proofSurface?.ProofId ?? "none"} chain={proofSurface?.MuninnEvidenceFrameId ?? "none"}->{proofSurface?.MimirEvidenceFrameId ?? "none"}->{proofSurface?.MimirPoseFrameId ?? "none"}->{proofSurface?.FensalirFrameId ?? "none"} verdict={proofSurface?.Verdict.ToString() ?? "none"} splines={proofSplineCount} duplicateSuppressed={duplicateSuppressed} configValid={configErrors.Length == 0} invalidDefaultErrors={invalidErrors.Length} activationActive={activationStatus?.Active.ToString() ?? "n/a"} activationDiagnostic=\"{activationStatus?.Diagnostic ?? ""}\"");
|
||||
$"move-proof-runtime-{(requireActivationSurface ? "activation-surface" : activateViaConfiguredSource ? "activation" : "driver")}-smoke proof={proofSurface?.ProofId ?? "none"} chain={proofSurface?.MuninnEvidenceFrameId ?? "none"}->{proofSurface?.MimirEvidenceFrameId ?? "none"}->{proofSurface?.MimirPoseFrameId ?? "none"}->{proofSurface?.FensalirFrameId ?? "none"} verdict={proofSurface?.Verdict.ToString() ?? "none"} splines={proofSplineCount} duplicateSuppressed={duplicateSuppressed} configValid={configErrors.Length == 0} invalidDefaultErrors={invalidErrors.Length} activationActive={activationStatus?.Active.ToString() ?? "n/a"} activationDiagnostic=\"{activationStatus?.Diagnostic ?? ""}\" activationDocumentActive={activationDocument?.Active.ToString() ?? "n/a"} activationProvider=\"{activationDocument?.ProviderKind ?? ""}\" unavailableActive={unavailableDocument?.Active.ToString() ?? "n/a"} unavailableDiagnostic=\"{unavailableDocument?.Diagnostic ?? ""}\"");
|
||||
|
||||
return proofSurface is not null &&
|
||||
activationOk &&
|
||||
activationSurfaceOk &&
|
||||
proofSurface.IsFullPose &&
|
||||
proofSurface.MuninnEvidenceFrameId == "muninn:nightwing:move-evidence:79" &&
|
||||
proofSurface.MimirEvidenceFrameId == "mimir:starfire:move-evidence:79" &&
|
||||
|
|
|
|||
|
|
@ -166,6 +166,16 @@ direct
|
|||
|
||||
public MimirMoveProofSurfaceDocument? LatestMoveProofSurface => latestMoveProofSurface;
|
||||
|
||||
public IReadOnlyList<MimirMoveProofRuntimeActivationDocument> CreateMoveProofRuntimeActivationDocuments(ulong observedAtNs) =>
|
||||
configuredMoveProofSources
|
||||
.Select(configuration => MimirMoveProofRuntimeActivation.CreateDocument(
|
||||
configuration,
|
||||
moveProofActivationStatuses.LastOrDefault(status =>
|
||||
string.Equals(status.EvidenceStreamId, configuration.EvidenceStreamId, StringComparison.Ordinal)),
|
||||
latestMoveProofSurface,
|
||||
observedAtNs))
|
||||
.ToArray();
|
||||
|
||||
private AquariumFrame CreateFrame()
|
||||
{
|
||||
var channelCount = Math.Max(1, lastAudioSpectra.Count);
|
||||
|
|
@ -623,48 +633,59 @@ direct
|
|||
|
||||
private void ActivateConfiguredMoveProofSource(MimirMoveProofRuntimeConfiguration configuration)
|
||||
{
|
||||
var providerKind = moveProofRingProvider.GetType().Name;
|
||||
try
|
||||
{
|
||||
var errors = configuration.Validate();
|
||||
if (errors.Length > 0)
|
||||
{
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, false, $"invalid: {string.Join("; ", errors)}");
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, false, $"invalid: {string.Join("; ", errors)}", providerKind, driverRegistered: false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!moveProofRingProvider.TryOpenEvidenceRing(configuration, out var ringLease, out var diagnostic) || ringLease is null)
|
||||
{
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, false, diagnostic);
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, false, diagnostic, providerKind, driverRegistered: false);
|
||||
return;
|
||||
}
|
||||
|
||||
MimirNativeReservoirRuntime? reservoir = null;
|
||||
try
|
||||
{
|
||||
var reservoir = new MimirNativeReservoirRuntime(configuration.NativeReservoirPath);
|
||||
reservoir = new MimirNativeReservoirRuntime(configuration.NativeReservoirPath);
|
||||
var driver = configuration.CreateDriver(ringLease.Ring, reservoir);
|
||||
moveProofDrivers.Add(driver);
|
||||
moveProofDriverResources.Add(reservoir);
|
||||
moveProofDriverResources.Add(ringLease);
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, true, diagnostic);
|
||||
reservoir = null;
|
||||
ringLease = null;
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, true, diagnostic, providerKind, driverRegistered: true);
|
||||
}
|
||||
catch
|
||||
finally
|
||||
{
|
||||
ringLease.Dispose();
|
||||
throw;
|
||||
reservoir?.Dispose();
|
||||
ringLease?.Dispose();
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, false, exception.Message);
|
||||
RecordMoveProofActivation(configuration.EvidenceStreamId, false, exception.Message, providerKind, driverRegistered: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void RecordMoveProofActivation(string evidenceStreamId, bool active, string diagnostic)
|
||||
private void RecordMoveProofActivation(
|
||||
string evidenceStreamId,
|
||||
bool active,
|
||||
string diagnostic,
|
||||
string providerKind,
|
||||
bool driverRegistered)
|
||||
{
|
||||
moveProofActivationStatuses.Add(new MimirMoveProofRuntimeActivationStatus(
|
||||
evidenceStreamId,
|
||||
active,
|
||||
string.IsNullOrWhiteSpace(diagnostic) ? (active ? "activated" : "not activated") : diagnostic));
|
||||
string.IsNullOrWhiteSpace(diagnostic) ? (active ? "activated" : "not activated") : diagnostic,
|
||||
providerKind,
|
||||
driverRegistered));
|
||||
}
|
||||
|
||||
private void EmitTelemetry()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using GameCult.Mesh;
|
||||
using GameCult.Caching;
|
||||
using MessagePack;
|
||||
|
||||
namespace Mimir.Runtime.Synchronization;
|
||||
|
||||
|
|
@ -34,7 +36,84 @@ public sealed class MimirMoveProofEvidenceRingLease : IDisposable
|
|||
public sealed record MimirMoveProofRuntimeActivationStatus(
|
||||
string EvidenceStreamId,
|
||||
bool Active,
|
||||
string Diagnostic);
|
||||
string Diagnostic,
|
||||
string ProviderKind,
|
||||
bool DriverRegistered);
|
||||
|
||||
[CultDocument("mimir.move_proof_runtime_activation", "mimir.move_proof_runtime_activation.v1")]
|
||||
[MessagePackObject]
|
||||
public sealed record MimirMoveProofRuntimeActivationDocument(
|
||||
[property: Key(0)]
|
||||
[property: CultName]
|
||||
string ActivationId,
|
||||
[property: Key(1)] string EvidenceStreamId,
|
||||
[property: Key(2)] bool Active,
|
||||
[property: Key(3)] string Diagnostic,
|
||||
[property: Key(4)] string ProviderKind,
|
||||
[property: Key(5)] bool DriverRegistered,
|
||||
[property: Key(6)] string NativeReservoirPath,
|
||||
[property: Key(7)] string[] CalibratedCameraIds,
|
||||
[property: Key(8)] int CalibratedCameraCount,
|
||||
[property: Key(9)] string LatestProofId,
|
||||
[property: Key(10)] string LatestMuninnEvidenceFrameId,
|
||||
[property: Key(11)] string LatestMimirEvidenceFrameId,
|
||||
[property: Key(12)] string LatestMimirPoseFrameId,
|
||||
[property: Key(13)] string LatestFensalirFrameId,
|
||||
[property: Key(14)] MimirMoveProofVerdict LatestVerdict,
|
||||
[property: Key(15)] ulong ObservedAtNs);
|
||||
|
||||
public static class MimirMoveProofRuntimeActivation
|
||||
{
|
||||
public static MimirMoveProofRuntimeActivationDocument CreateDocument(
|
||||
MimirMoveProofRuntimeConfiguration configuration,
|
||||
MimirMoveProofRuntimeActivationStatus? status,
|
||||
MimirMoveProofSurfaceDocument? latestProofSurface,
|
||||
ulong observedAtNs)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(configuration);
|
||||
var active = status?.Active ?? false;
|
||||
var diagnostic = status?.Diagnostic ?? "not activated";
|
||||
var providerKind = status?.ProviderKind ?? "";
|
||||
var driverRegistered = status?.DriverRegistered ?? false;
|
||||
var matchingSurface = IsSurfaceFromEvidenceStream(latestProofSurface, configuration.EvidenceStreamId)
|
||||
? latestProofSurface
|
||||
: null;
|
||||
|
||||
return new MimirMoveProofRuntimeActivationDocument(
|
||||
ActivationId: $"{configuration.EvidenceStreamId}:activation",
|
||||
EvidenceStreamId: configuration.EvidenceStreamId,
|
||||
Active: active,
|
||||
Diagnostic: diagnostic,
|
||||
ProviderKind: providerKind,
|
||||
DriverRegistered: driverRegistered,
|
||||
NativeReservoirPath: configuration.NativeReservoirPath,
|
||||
CalibratedCameraIds: configuration.Calibration.Cameras
|
||||
.Select(camera => camera.CameraId)
|
||||
.Where(cameraId => !string.IsNullOrWhiteSpace(cameraId))
|
||||
.ToArray(),
|
||||
CalibratedCameraCount: configuration.Calibration.Cameras.Count,
|
||||
LatestProofId: matchingSurface?.ProofId ?? "",
|
||||
LatestMuninnEvidenceFrameId: matchingSurface?.MuninnEvidenceFrameId ?? "",
|
||||
LatestMimirEvidenceFrameId: matchingSurface?.MimirEvidenceFrameId ?? "",
|
||||
LatestMimirPoseFrameId: matchingSurface?.MimirPoseFrameId ?? "",
|
||||
LatestFensalirFrameId: matchingSurface?.FensalirFrameId ?? "",
|
||||
LatestVerdict: matchingSurface?.Verdict ?? MimirMoveProofVerdict.Unknown,
|
||||
ObservedAtNs: observedAtNs);
|
||||
}
|
||||
|
||||
private static bool IsSurfaceFromEvidenceStream(
|
||||
MimirMoveProofSurfaceDocument? latestProofSurface,
|
||||
string evidenceStreamId)
|
||||
{
|
||||
if (latestProofSurface is null || string.IsNullOrWhiteSpace(evidenceStreamId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return string.Equals(latestProofSurface.MuninnEvidenceFrameId, evidenceStreamId, StringComparison.Ordinal) ||
|
||||
latestProofSurface.MuninnEvidenceFrameId.StartsWith($"{evidenceStreamId}:", StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class MimirUnavailableMoveProofEvidenceRingProvider : IMimirMoveProofEvidenceRingProvider
|
||||
{
|
||||
|
|
|
|||
|
|
@ -166,3 +166,4 @@
|
|||
{"ts": "2026-07-08T22:55:54+01:00", "type": "verification", "status": "ok", "note": "Added and verified the Fensalir presented-frame proof smoke. MIMIR_MOVE_PROOF_DEV_SURFACE gates a synthetic calibrated proof surface through the same MimirRuntime.PublishMoveProofSurface path, and BufferSmoke --move-proof-presented-frame-smoke runs Mimir.App headless, captures artifacts/runtime/move-proof-presented-frame-smoke.png, and pixel-checks the rendered proof probe. Latest run captured fensalir:starfire:presented-frame:79 for proof mimir:starfire:move-proof:79 with bytes=11260 and brightPixels=1069; adjacent runtime-driver, runtime-frame, proof-surface, and proof-pipeline smokes pass. This proves the renderer/probe layer for the named proof chain, not live Nightwing hardware or calibrated field evidence."}
|
||||
{"ts": "2026-07-12T10:26:42+01:00", "type": "verification", "status": "ok", "note": "Added MimirMoveProofRuntimeConfiguration as the typed config/validation surface for Move proof driver creation. The runtime config now accepts enabled MoveProof sources, validates named Muninn evidence stream, native reservoir path, Mimir/Fensalir frame prefixes, fusion authority, consumer contract, and at least two calibrated camera witnesses, and creates a driver only when the supplied CultMesh ring stream id matches. Verified dotnet build Mimir.Runtime, dotnet build Mimir.BufferSmoke, BufferSmoke --move-proof-runtime-config-smoke, --move-proof-runtime-driver-smoke, --move-proof-pipeline-smoke, and --move-proof-presented-frame-smoke. The config smoke printed configValid=True invalidDefaultErrors=2 and the same sequence chain muninn:nightwing:move-evidence:79 -> mimir:starfire:move-evidence:79 -> mimir:starfire:move-pose:79 -> fensalir:starfire:presented-frame:79. This proves config plus in-process ring flow, not live Nightwing hardware, calibrated field cameras, or cross-process ring opening."}
|
||||
{"ts": "2026-07-12T10:51:37+01:00", "type": "verification", "status": "ok", "note": "MimirRuntime now owns configured Move proof activation instead of leaving MoveProof config as a passive readout. On scene-ready it asks IMimirMoveProofEvidenceRingProvider for the configured Muninn evidence ring, opens the configured native reservoir, creates/registers MimirMoveProofRuntimeDriver, retains resources, and records activation status. The default provider fails explicitly because the current C# CultMesh ring is in-process only. Verified dotnet build Mimir.Runtime, dotnet build Mimir.BufferSmoke, BufferSmoke --move-proof-runtime-driver-smoke, and BufferSmoke --move-proof-runtime-activation-smoke. The activation smoke injected an in-process provider and printed activationActive=True while preserving the explicit chain muninn:nightwing:move-evidence:79 -> mimir:starfire:move-evidence:79 -> mimir:starfire:move-pose:79 -> fensalir:starfire:presented-frame:79 with verdict=FullPose. This proves runtime config activation and status, not live Nightwing/Starfire hardware or cross-process ring opening."}
|
||||
{"ts": "2026-07-12T11:01:09+01:00", "type": "implementation", "status": "ok", "note": "Added mimir.move_proof_runtime_activation.v1 as the typed readiness/proof-spine surface for configured Move proof sources. It reports stream id, provider kind, active/driver state, reservoir path, calibrated camera ids, latest same-stream proof ids/verdict, and unavailable-provider diagnostics. MimirRuntime now exposes CreateMoveProofRuntimeActivationDocuments and disposes a native reservoir if activation fails before driver retention. Verified dotnet build Mimir.Runtime, dotnet build Mimir.BufferSmoke, BufferSmoke --move-proof-runtime-driver-smoke, --move-proof-runtime-activation-smoke, and --move-proof-runtime-activation-surface-smoke against the native reservoir debug DLL. The new smoke proves active injected-ring and inactive default-provider documents; real Nightwing/Starfire hardware and cross-process CultMesh ring opening remain pending."}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,13 @@ accepted_design:
|
|||
`Mimir.BufferSmoke --move-proof-runtime-activation-smoke` injects an
|
||||
in-process provider to prove the activation path without claiming live
|
||||
Nightwing/Starfire field evidence.
|
||||
- `mimir.move_proof_runtime_activation.v1` is the typed readiness/proof-spine
|
||||
surface for configured Move proof sources. It reports the configured stream,
|
||||
provider kind, active/driver state, native reservoir path, calibrated camera
|
||||
ids, latest same-stream proof ids, latest verdict, and unavailable-provider
|
||||
diagnostic. `Mimir.BufferSmoke --move-proof-runtime-activation-surface-smoke`
|
||||
proves both an active injected-ring document and the inactive default
|
||||
runtime document without claiming live field evidence.
|
||||
- `MimirMoveProofDevSurface` is a dev-only bootstrap gated by
|
||||
`MIMIR_MOVE_PROOF_DEV_SURFACE`. It publishes a synthetic calibrated proof
|
||||
surface through the same MimirRuntime attachment so headless Mimir.App can
|
||||
|
|
|
|||
Loading…
Reference in a new issue