instrument: fix AHD node-tracking/tie-break/live-latch defects and close staged-envelope-curve test gaps

This commit is contained in:
2026-07-31 09:52:17 -04:00
parent d60ab1524a
commit 2fa1405b06
27 changed files with 360 additions and 86 deletions
+21
View File
@@ -681,6 +681,26 @@ static void testNonFiniteFilterFieldsLiftToTheNeutralDefault() {
CHECK(g.enabled);
}
// A non-finite attackSeconds/decaySeconds on a stored AHD (a corrupt blob) must lift to 0
// seconds rather than reach resolvePlay's static_cast<std::int64_t> (sample_map.cpp) — UB on
// NaN, and on a large-enough finite value. Mirrors
// testNonFiniteFilterFieldsLiftToTheNeutralDefault's per-field precedent, on the v10 AHD tail.
static void testNonFiniteAhdSecondsLiftToZero() {
ComponentState in;
in.selectionId = "pad";
in.params.play.trigAhd.attackSeconds = std::numeric_limits<double>::quiet_NaN();
in.params.play.trigAhd.decaySeconds = std::numeric_limits<double>::infinity();
in.params.play.filter.trigEnv.attackSeconds = -std::numeric_limits<double>::infinity();
in.params.play.filter.trigEnv.decaySeconds = std::numeric_limits<double>::quiet_NaN();
const ComponentState out =
deserializeComponentState(serializeComponentState(in), 48000.0);
CHECK(out.params.play.trigAhd.attackSeconds == 0.0);
CHECK(out.params.play.trigAhd.decaySeconds == 0.0);
CHECK(out.params.play.filter.trigEnv.attackSeconds == 0.0);
CHECK(out.params.play.filter.trigEnv.decaySeconds == 0.0);
}
// The WRITER emits the CURRENT payload version, and the marker + version sit at the head of
// the payload — the self-describing property every legacy branch depends on. Asserted
// against the semantic constants, not literals.
@@ -1273,6 +1293,7 @@ int main() {
testV8RecordLiftsToTheOffNeutralFilter();
testFilterTailRoundTripsLosslessly();
testNonFiniteFilterFieldsLiftToTheNeutralDefault();
testNonFiniteAhdSecondsLiftToZero();
if (failures == 0) {
std::printf("component_state_io_tests: all tests passed\n");
return 0;