Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/architecture/M3_RENDER_PATH_EVIDENCE_20261111.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ Retire an M4 branch only after actual native field sessions show no M4
render deltas with equivalent VST3/FX, channel meters, bus and physical MAIN
performance across restart, devices and output mute. Never permit legacy
fallback merely because native publication failed.

## M3b conservative window evaluation (source-only helper)

The native audit header now exposes `ProductionRenderAudit::assessWindow(before,after,sameProcess,sameDeviceEpoch,channelIdAdmittedAtBothEnds)` for CONTROL/field-evidence analysis. Supply two independent `dryRoutingLab.renderAudit` observations **and** verify the actual device epoch and installed ChannelId admission at both ends; these booleans are external observations, never inferred from a WebView status badge.

The result `exclusiveNativeObserved` requires at least one **completed** native callback in the bounded window, zero newly rendered M4 blocks, zero native failures or overlap denials, and zero unpatched/muted-no-render exits. It rejects process/device epoch discontinuity, counter regression/reset, and unsettled endpoint snapshots (which can occur because the source counters are independent relaxed atomics). An M4 total from a *previous* window does not itself disqualify current native-only evidence; an M4 increment **in** the window always does.

This deliberately does **not** authorize audio, promise audible ASIO, qualify a device, or automatically remove the compatibility code. A single clean window is insufficient for M3b retirement. Repeat across real hardware sessions and record the matching output identity, source-only and WIRE/BUS/FX PCM fixtures, muted/not-muted state, sample rate/buffer transitions, and independent headphone listening. Until then M4 remains reachable. No new renderer, UI polling, or heavy workflow is introduced.
64 changes: 64 additions & 0 deletions engine/core/ProductionRenderAudit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,70 @@ class ProductionRenderAudit final {
std::uint64_t m4Started=0,m4Completed=0,m4Failed=0;
std::uint64_t overlapDenied=0,unpatchedSilent=0,mutedNoRender=0;
};
// CONTROL/field diagnostics only. The caller must supply two snapshots
// from the same process and same *physical* device epoch, both with an
// independently verified installed ChannelId admission. This never grants
// permission to render, arm an output, or retire legacy code.
enum class WindowStatus : std::uint8_t {
invalidContext, countersRegressed, boundaryInFlight,
legacyRendered, nativeFailed, noNativeRender,
silentOrMuted, exclusiveNativeObserved
};
struct RenderWindow {
WindowStatus status=WindowStatus::invalidContext;
Snapshot delta{};
[[nodiscard]] constexpr bool exclusiveNativeObserved() const noexcept {
return status==WindowStatus::exclusiveNativeObserved;
}
};
[[nodiscard]] static constexpr RenderWindow assessWindow(
Snapshot before,Snapshot after,bool sameProcess,
bool sameDeviceEpoch,bool channelIdAdmittedAtBothEnds) noexcept {
if(!sameProcess || !sameDeviceEpoch || !channelIdAdmittedAtBothEnds)
return {WindowStatus::invalidContext,{}};
const auto monotonic=[](Snapshot x,Snapshot y) constexpr noexcept {
return y.nativeStarted>=x.nativeStarted &&
y.nativeCompleted>=x.nativeCompleted &&
y.nativeFailed>=x.nativeFailed &&
y.m4Started>=x.m4Started &&
y.m4Completed>=x.m4Completed &&
y.m4Failed>=x.m4Failed &&
y.overlapDenied>=x.overlapDenied &&
y.unpatchedSilent>=x.unpatchedSilent &&
y.mutedNoRender>=x.mutedNoRender;
};
if(!monotonic(before,after))
return {WindowStatus::countersRegressed,{}};
// Relaxed atomic CONTROL snapshots can catch one callback in flight.
// Neither partial endpoint is valid proof of a completed DSP window.
const auto settled=[](Snapshot s) constexpr noexcept {
return s.nativeStarted>=s.nativeCompleted &&
s.nativeStarted-s.nativeCompleted==s.nativeFailed &&
s.m4Started>=s.m4Completed &&
s.m4Started-s.m4Completed==s.m4Failed;
};
if(!settled(before) || !settled(after))
return {WindowStatus::boundaryInFlight,{}};
const Snapshot delta{
after.nativeStarted-before.nativeStarted,
after.nativeCompleted-before.nativeCompleted,
after.nativeFailed-before.nativeFailed,
after.m4Started-before.m4Started,
after.m4Completed-before.m4Completed,
after.m4Failed-before.m4Failed,
after.overlapDenied-before.overlapDenied,
after.unpatchedSilent-before.unpatchedSilent,
after.mutedNoRender-before.mutedNoRender};
if(delta.m4Started || delta.m4Completed || delta.m4Failed)
return {WindowStatus::legacyRendered,delta};
if(delta.nativeFailed || delta.overlapDenied)
return {WindowStatus::nativeFailed,delta};
if(delta.nativeCompleted==0)
return {WindowStatus::noNativeRender,delta};
if(delta.unpatchedSilent || delta.mutedNoRender)
return {WindowStatus::silentOrMuted,delta};
return {WindowStatus::exclusiveNativeObserved,delta};
}
ProductionRenderAudit()=default;
ProductionRenderAudit(const ProductionRenderAudit&)=delete;
ProductionRenderAudit& operator=(const ProductionRenderAudit&)=delete;
Expand Down
65 changes: 65 additions & 0 deletions tests/production_render_audit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,69 @@ int main() {
assert(s.overlapDenied==1&&s.unpatchedSilent==2&&s.mutedNoRender==1);
assert(s.nativeStarted==s.nativeCompleted+s.nativeFailed);
assert(s.m4Started==s.m4Completed+s.m4Failed);

// M3b source-retirement gate: read two real counter boundaries, not
// process-lifetime totals. Historical M4 blocks must not taint a new
// native-only window, but a fresh M4 block must disqualify it.
using Status=Audit::WindowStatus;
const auto begin=a.snapshot();
for(int i=0;i<4;++i) {
a.started(Audit::Path::channelId);
a.completed(Audit::Path::channelId);
}
const auto end=a.snapshot();
const auto verified=Audit::assessWindow(begin,end,true,true,true);
assert(verified.exclusiveNativeObserved());
assert(verified.delta.nativeCompleted==4);
assert(verified.delta.m4Started==0);
assert(verified.delta.nativeFailed==0);

assert(Audit::assessWindow(begin,end,false,true,true).status==
Status::invalidContext);
assert(Audit::assessWindow(begin,end,true,false,true).status==
Status::invalidContext);
assert(Audit::assessWindow(begin,end,true,true,false).status==
Status::invalidContext);

auto reset=end;
--reset.m4Completed;
assert(Audit::assessWindow(begin,reset,true,true,true).status==
Status::countersRegressed);
auto mid=end;
++mid.nativeStarted; // asynchronous CONTROL read during DSP callback
assert(Audit::assessWindow(begin,mid,true,true,true).status==
Status::boundaryInFlight);
auto beforePartial=begin;
++beforePartial.nativeStarted;
assert(Audit::assessWindow(beforePartial,end,true,true,true).status==
Status::boundaryInFlight);

auto withLegacy=end;
++withLegacy.m4Started;++withLegacy.m4Completed;
const auto fallback=Audit::assessWindow(begin,withLegacy,true,true,true);
assert(fallback.status==Status::legacyRendered);
assert(fallback.delta.m4Completed==1);

auto withFailure=end;
++withFailure.nativeStarted;++withFailure.nativeFailed;
assert(Audit::assessWindow(begin,withFailure,true,true,true).status==
Status::nativeFailed);
auto withOverlap=end;
++withOverlap.overlapDenied;
assert(Audit::assessWindow(begin,withOverlap,true,true,true).status==
Status::nativeFailed);

auto noNewBlock=Audit::assessWindow(end,end,true,true,true);
assert(noNewBlock.status==Status::noNativeRender);
auto withMute=end;
++withMute.mutedNoRender;
assert(Audit::assessWindow(begin,withMute,true,true,true).status==
Status::silentOrMuted);
auto withUnpatched=end;
++withUnpatched.unpatchedSilent;
assert(Audit::assessWindow(begin,withUnpatched,true,true,true).status==
Status::silentOrMuted);

// A clean native window is *render ownership evidence only*. Neither
// this test nor the classifier is an audible ASIO physical FAT.
}
Loading