Add Move proof evidence snapshot fallback

This commit is contained in:
Meta Vens 2026-07-12 11:10:17 +01:00
commit dd45a478a6
8 changed files with 209 additions and 8 deletions

View file

@ -129,6 +129,15 @@ a named invariant that the native runtime cannot protect yet.
--move-proof-runtime-activation-surface-smoke` proves both an active injected
ring document and the inactive default runtime document without claiming live
field evidence.
- `mimir.move_proof_evidence_frame_snapshot.v1` is the one-copy fallback for
captured Muninn evidence frames while C# CultMesh has no cross-process ring
opener. A configured `EvidenceSnapshotPath` is loaded by
`MimirConfiguredMoveProofEvidenceRingProvider`, metadata-checked against the
encoded payload, copied into an owned in-process ring, and then consumed by
the same runtime driver/pipeline. `Mimir.BufferSmoke
--move-proof-runtime-snapshot-smoke` proves the named proof spine through
that file boundary. It is field capture/replay support, not the final live
shared-memory proof.
- `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`

View file

@ -247,6 +247,16 @@ 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.
`mimir.move_proof_evidence_frame_snapshot.v1` is a one-copy, explicitly
non-final fallback for captured Muninn evidence frames while C# CultMesh lacks
a cross-process shared-memory opener. When `EvidenceSnapshotPath` is
configured, `MimirConfiguredMoveProofEvidenceRingProvider` validates snapshot
metadata against the encoded Muninn frame payload, publishes the payload into
an owned in-process ring, and then delegates to the same runtime proof driver
and pipeline. `Mimir.BufferSmoke --move-proof-runtime-snapshot-smoke` proves
the same named proof spine through that file boundary. This can support field
capture/replay, but live proof still requires the real Nightwing/Starfire ring
or CultMesh page producer.
`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

View file

@ -182,7 +182,17 @@ if (args.Any(arg => string.Equals(arg, "--move-proof-runtime-activation-surface-
return RunMoveProofRuntimeDriverSmoke(
ParseStringOption(args, "--native-reservoir", DefaultNativeReservoirPath()),
activateViaConfiguredSource: true,
requireActivationSurface: true);
requireActivationSurface: true,
activateViaSnapshotProvider: false);
}
if (args.Any(arg => string.Equals(arg, "--move-proof-runtime-snapshot-smoke", StringComparison.OrdinalIgnoreCase)))
{
return RunMoveProofRuntimeDriverSmoke(
ParseStringOption(args, "--native-reservoir", DefaultNativeReservoirPath()),
activateViaConfiguredSource: true,
requireActivationSurface: true,
activateViaSnapshotProvider: true);
}
if (args.Any(arg => string.Equals(arg, "--move-proof-presented-frame-smoke", StringComparison.OrdinalIgnoreCase)))
@ -2297,7 +2307,8 @@ static int RunMoveProofRuntimeFrameSmoke()
static int RunMoveProofRuntimeDriverSmoke(
string nativeReservoirPath,
bool activateViaConfiguredSource,
bool requireActivationSurface = false)
bool requireActivationSurface = false,
bool activateViaSnapshotProvider = false)
{
if (!File.Exists(nativeReservoirPath))
{
@ -2309,6 +2320,9 @@ static int RunMoveProofRuntimeDriverSmoke(
const ulong rightWitnessHash = 0x0000000000000B0B;
const string observedAt = "2026-06-11T18:30:00.0040000Z";
var streamId = "muninn:nightwing:move-evidence";
var snapshotPath = activateViaSnapshotProvider
? Path.Combine(Path.GetTempPath(), $"mimir-move-proof-evidence-{Guid.NewGuid():N}.mpack")
: "";
var frame = new MimirMuninnMoveEvidenceStreamFrame(
FrameId: "muninn:nightwing:move-evidence:79",
ProducerPeerId: "muninn:nightwing",
@ -2367,6 +2381,7 @@ static int RunMoveProofRuntimeDriverSmoke(
var configuration = new MimirMoveProofRuntimeConfiguration
{
EvidenceStreamId = streamId,
EvidenceSnapshotPath = snapshotPath,
NativeReservoirPath = nativeReservoirPath,
MimirEvidenceSourceId = "mimir:starfire:move-evidence",
MimirEvidenceFramePrefix = "mimir:starfire:move-evidence",
@ -2422,6 +2437,16 @@ static int RunMoveProofRuntimeDriverSmoke(
"nightwing:clock"));
using var ring = catalog.CreateSharedMemoryRing(streamId, slotCount: 4, slotByteLength: 8192);
var payload = MimirMuninnMoveEvidenceAdapter.SerializeStreamFrame(frame);
if (activateViaSnapshotProvider)
{
MimirMoveProofEvidenceFrameSnapshot.Save(
snapshotPath,
MimirMoveProofEvidenceFrameSnapshot.Create(
frame,
payload,
capturedAtNs: 1_781_202_600_005_500_000));
}
if (!ring.TryPublishCopy(payload, frame.PublishedAtNs, durationNs: 0, out var published))
{
Console.Error.WriteLine("move-proof-runtime-driver-smoke publish-failed");
@ -2434,7 +2459,15 @@ static int RunMoveProofRuntimeDriverSmoke(
? null
: configuration.CreateDriver(ring, manualReservoir!);
using var runtime = activateViaConfiguredSource
? new MimirRuntime(
? activateViaSnapshotProvider
? new MimirRuntime(
new AquariumRuntimeOptions(Headless: true, CultCachePath: ""),
new MimirRuntimeConfiguration
{
Settings = new MimirSynchronizationSettings(),
MoveProofSources = [configuration],
})
: new MimirRuntime(
new AquariumRuntimeOptions(Headless: true, CultCachePath: ""),
new MimirRuntimeConfiguration
{
@ -2478,10 +2511,12 @@ static int RunMoveProofRuntimeDriverSmoke(
LatestFensalirFrameId: "fensalir:starfire:presented-frame:79",
LatestVerdict: MimirMoveProofVerdict.FullPose,
CalibratedCameraCount: 2
};
} &&
(!activateViaSnapshotProvider ||
activationDocument.Diagnostic.Contains("one-copy evidence snapshot supplied", StringComparison.Ordinal));
MimirMoveProofRuntimeActivationDocument? unavailableDocument = null;
if (requireActivationSurface)
if (requireActivationSurface && !activateViaSnapshotProvider)
{
using var unavailableRuntime = new MimirRuntime(
new AquariumRuntimeOptions(Headless: true, CultCachePath: ""),
@ -2505,9 +2540,9 @@ static int RunMoveProofRuntimeDriverSmoke(
}
Console.WriteLine(
$"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 ?? ""}\"");
$"move-proof-runtime-{(activateViaSnapshotProvider ? "snapshot" : 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 ?? ""}\" snapshot=\"{snapshotPath}\"");
return proofSurface is not null &&
var result = proofSurface is not null &&
activationOk &&
activationSurfaceOk &&
proofSurface.IsFullPose &&
@ -2520,6 +2555,12 @@ static int RunMoveProofRuntimeDriverSmoke(
duplicateSuppressed
? 0
: 1;
if (!string.IsNullOrWhiteSpace(snapshotPath) && File.Exists(snapshotPath))
{
File.Delete(snapshotPath);
}
return result;
}
static int RunMoveProofPresentedFrameSmoke(string outputPath)

View file

@ -81,7 +81,7 @@ direct
configuration.Settings,
configuration.SourceFactories,
configuration.MoveProofSources,
MimirUnavailableMoveProofEvidenceRingProvider.Instance)
MimirConfiguredMoveProofEvidenceRingProvider.Instance)
{
}

View file

@ -33,6 +33,69 @@ public sealed class MimirMoveProofEvidenceRingLease : IDisposable
}
}
[CultDocument("mimir.move_proof_evidence_frame_snapshot", "mimir.move_proof_evidence_frame_snapshot.v1")]
[MessagePackObject]
public sealed record MimirMoveProofEvidenceFrameSnapshotDocument(
[property: Key(0)]
[property: CultName]
string SnapshotId,
[property: Key(1)] string EvidenceStreamId,
[property: Key(2)] string FrameId,
[property: Key(3)] string ProducerPeerId,
[property: Key(4)] long PublishedAtNs,
[property: Key(5)] ulong CapturedAtNs,
[property: Key(6)] byte[] Payload);
public static class MimirMoveProofEvidenceFrameSnapshot
{
public static MimirMoveProofEvidenceFrameSnapshotDocument Create(
MimirMuninnMoveEvidenceStreamFrame frame,
byte[] payload,
ulong capturedAtNs)
{
ArgumentNullException.ThrowIfNull(frame);
ArgumentNullException.ThrowIfNull(payload);
if (payload.Length == 0)
{
throw new ArgumentException("Snapshot payload must not be empty.", nameof(payload));
}
return new MimirMoveProofEvidenceFrameSnapshotDocument(
SnapshotId: $"{frame.FrameId}:snapshot",
EvidenceStreamId: StreamIdFromFrameId(frame.FrameId),
FrameId: frame.FrameId,
ProducerPeerId: frame.ProducerPeerId,
PublishedAtNs: frame.PublishedAtNs,
CapturedAtNs: capturedAtNs,
Payload: payload);
}
public static MimirMoveProofEvidenceFrameSnapshotDocument Load(string path)
{
ArgumentException.ThrowIfNullOrWhiteSpace(path);
return MessagePackSerializer.Deserialize<MimirMoveProofEvidenceFrameSnapshotDocument>(File.ReadAllBytes(path));
}
public static void Save(string path, MimirMoveProofEvidenceFrameSnapshotDocument snapshot)
{
ArgumentException.ThrowIfNullOrWhiteSpace(path);
ArgumentNullException.ThrowIfNull(snapshot);
var directory = Path.GetDirectoryName(Path.GetFullPath(path));
if (!string.IsNullOrWhiteSpace(directory))
{
Directory.CreateDirectory(directory);
}
File.WriteAllBytes(path, MessagePackSerializer.Serialize(snapshot));
}
private static string StreamIdFromFrameId(string frameId)
{
var separator = frameId.LastIndexOf(':');
return separator > 0 ? frameId[..separator] : frameId;
}
}
public sealed record MimirMoveProofRuntimeActivationStatus(
string EvidenceStreamId,
bool Active,
@ -115,6 +178,72 @@ public static class MimirMoveProofRuntimeActivation
}
}
public sealed class MimirConfiguredMoveProofEvidenceRingProvider : IMimirMoveProofEvidenceRingProvider
{
public static MimirConfiguredMoveProofEvidenceRingProvider Instance { get; } = new();
private MimirConfiguredMoveProofEvidenceRingProvider()
{
}
public bool TryOpenEvidenceRing(
MimirMoveProofRuntimeConfiguration configuration,
out MimirMoveProofEvidenceRingLease? lease,
out string diagnostic)
{
ArgumentNullException.ThrowIfNull(configuration);
if (string.IsNullOrWhiteSpace(configuration.EvidenceSnapshotPath))
{
return MimirUnavailableMoveProofEvidenceRingProvider.Instance.TryOpenEvidenceRing(
configuration,
out lease,
out diagnostic);
}
var snapshotPath = Path.GetFullPath(configuration.EvidenceSnapshotPath);
if (!File.Exists(snapshotPath))
{
lease = null;
diagnostic = $"Move proof evidence snapshot not found: {snapshotPath}";
return false;
}
var snapshot = MimirMoveProofEvidenceFrameSnapshot.Load(snapshotPath);
if (!string.Equals(snapshot.EvidenceStreamId, configuration.EvidenceStreamId, StringComparison.Ordinal))
{
lease = null;
diagnostic = $"Move proof evidence snapshot stream '{snapshot.EvidenceStreamId}' does not match configured evidence stream '{configuration.EvidenceStreamId}'.";
return false;
}
var decoded = MimirMuninnMoveEvidenceAdapter.DeserializeStreamFrame(snapshot.Payload);
if (!string.Equals(decoded.FrameId, snapshot.FrameId, StringComparison.Ordinal) ||
!string.Equals(decoded.ProducerPeerId, snapshot.ProducerPeerId, StringComparison.Ordinal) ||
decoded.PublishedAtNs != snapshot.PublishedAtNs)
{
lease = null;
diagnostic = "Move proof evidence snapshot metadata does not match its encoded Muninn frame payload.";
return false;
}
var ring = new CultMeshSharedMemoryFrameRing(
configuration.EvidenceStreamId,
slotCount: 1,
slotByteLength: snapshot.Payload.Length);
if (!ring.TryPublishCopy(snapshot.Payload, snapshot.PublishedAtNs, durationNs: 0, out _))
{
ring.Dispose();
lease = null;
diagnostic = $"Move proof evidence snapshot could not be published into fallback ring: {snapshotPath}";
return false;
}
lease = new MimirMoveProofEvidenceRingLease(ring, ownsRing: true);
diagnostic = $"one-copy evidence snapshot supplied from {snapshotPath}; this is not a live cross-process CultMesh ring";
return true;
}
}
public sealed class MimirUnavailableMoveProofEvidenceRingProvider : IMimirMoveProofEvidenceRingProvider
{
public static MimirUnavailableMoveProofEvidenceRingProvider Instance { get; } = new();

View file

@ -8,6 +8,8 @@ public sealed class MimirMoveProofRuntimeConfiguration
public string EvidenceStreamId { get; init; } = "muninn:nightwing:move-evidence";
public string EvidenceSnapshotPath { get; init; } = "";
public string NativeReservoirPath { get; init; } = "";
public string MimirEvidenceSourceId { get; init; } = "mimir:starfire:move-evidence";

View file

@ -167,3 +167,4 @@
{"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."}
{"ts": "2026-07-12T11:09:32+01:00", "type": "implementation", "status": "ok", "note": "Added mimir.move_proof_evidence_frame_snapshot.v1 and MimirConfiguredMoveProofEvidenceRingProvider as an explicit one-copy fallback for captured Muninn Move evidence frames while C# CultMesh lacks a cross-process shared-memory opener. EvidenceSnapshotPath snapshots are metadata-checked against the encoded Muninn frame payload, copied into an owned in-process ring, and consumed by the same runtime proof driver/pipeline. Verified dotnet build Mimir.Runtime, dotnet build Mimir.BufferSmoke, BufferSmoke --move-proof-runtime-driver-smoke, --move-proof-runtime-activation-surface-smoke, and --move-proof-runtime-snapshot-smoke against the native reservoir debug DLL. This supports field capture/replay and does not complete the live Nightwing/Starfire ring proof."}

View file

@ -177,6 +177,15 @@ accepted_design:
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.
- `mimir.move_proof_evidence_frame_snapshot.v1` is the one-copy fallback for
captured Muninn evidence frames while C# CultMesh has no cross-process ring
opener. A configured `EvidenceSnapshotPath` is loaded by
`MimirConfiguredMoveProofEvidenceRingProvider`, metadata-checked against the
encoded payload, copied into an owned in-process ring, and then consumed by
the same runtime driver/pipeline. `Mimir.BufferSmoke
--move-proof-runtime-snapshot-smoke` proves the named proof spine through
that file boundary. It is field capture/replay support, not the final live
shared-memory proof.
- `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