diff --git a/docs/dings-patch-identity-authority-map.md b/docs/dings-patch-identity-authority-map.md
index b6e70e4..a5e6d29 100644
--- a/docs/dings-patch-identity-authority-map.md
+++ b/docs/dings-patch-identity-authority-map.md
@@ -345,6 +345,9 @@ Rules for every step: deprecate before removing (mark the old path with a pointe
**Step 3. Content revision** (replace the literal 1 with a catalog hash). Deliberately breaks byte-identity: compile keys, session ids and `sessions/<...>.cc` names all change. Needs its own ruling on what feeds the hash and whether old session files are left or removed. Verify: receipts before and after, with the old keys listed as expected to change. Rollback: revert to literal 1; new session files stay as orphans, harmless.
-**Step 4. One validation gate** (`DingService.cs:9-11` versus `DingsPlaybackHost.cs:66-68`). Make the Host the owner and let the bridge forward (the bridge's check, which `DingsBridgeTests` may need for fail-fast, stays as the deprecated path); keep the bridge check as deprecated fail-fast for one window. Verify: `DingsBridgeTests`. Rollback: revert; both gates read one dictionary, so behaviour is the same either way.
+**Step 4. One validation gate (done in this change).** Finding: both gates already read the same `DingCatalog.Events` / `DingCatalog.Instruments` dictionaries, so the change is the single rule text, not the data. The Host was already the only enforcing gate (every pipe client passes it); the bridge check is a pre-filter that cannot be forwarded away without a visible change (bridge throws `ArgumentException` / `ArgumentOutOfRangeException`, the Host path surfaces as `InvalidOperationException`; the bridge also lets a NaN gain through to the Host's rejection). So: `DingCatalog.PlayRejection(eventId, instrumentId, gain)` is now the one rule and returns the Host's exact rejection text or null; `DingsPlaybackHost.PlayAsync` calls it (same texts, same `rejected` status, same non-finite gain rejection). `DingService.PlayAsync` keeps its own check unchanged, marked DEPRECATED with a pointer comment; remove it only in a separate PR after the window. No protocol change, no identity change, no audible change.
+- Verify (ran): `DingCatalogTests` + `DingsBridgeTests` + all `Ding*`/`StoreFileName*` focused tests (79 passed, includes the step-1 identity pins untouched); `dotnet build tools/AquaSynthDingsHost` clean. New tests pin the gate texts (incl. NaN/Infinity), that the Host calls the gate and carries no second copy of the text, and that the deprecated bridge path keeps its exception types, sends nothing to the Host when it rejects, and agrees with the gate's texts. Each was mutation-checked (text change, gate call removed from Host, bridge exception type/text changed, NaN check dropped): each mutation failed at least one test.
+- Not verified: the Host rejecting over a live pipe (compile-checked and read; no Host test project exists and none was added); nothing heard.
+- Rollback: revert; both gates read one dictionary, so behaviour is the same either way.
**Step 5. Echo sites by reference.** (a) Neutral fallback in `tools/dings-voices/build.mjs` names a catalog instrument id. (b) Earcon Workshop `IDENTITIES`: export the shared ids and root frequencies from the catalog into a checked-in file (as `lowered-dings` is), guarded by a test, and have `earcon.js` read it; the voice-model parameters stay workshop-owned and the drifted values (table in section E) need an owner's decision first. Deprecation: `IDENTITIES` keeps its inline values, marked, until the generated file is read in production. Verify: `tools/earcon-workshop/test.mjs`, the guard test, and an ear check, since the workshop values were never tuned to the catalog. Rollback: revert; the inline values still exist.
diff --git a/src/AquaSynth.Dings/DingCatalog.cs b/src/AquaSynth.Dings/DingCatalog.cs
index 5f1241f..df4659e 100644
--- a/src/AquaSynth.Dings/DingCatalog.cs
+++ b/src/AquaSynth.Dings/DingCatalog.cs
@@ -13,6 +13,16 @@ public static class DingCatalog
public static DingPatchIdentity Identity(DingInstrument instrument) =>
new($"dings.{instrument.Id}", $"dings_{instrument.Id.Replace('-', '_')}", 1);
+ /// The play validation gate. The Host is its enforcing owner (every pipe client passes it); the MCP bridge's
+ /// own check in DingService.PlayAsync is a deprecated fail-fast path. Returns the rejection text, or null when valid.
+ public static string? PlayRejection(string eventId, string instrumentId, float gain)
+ {
+ if (!Events.ContainsKey(eventId)) return $"Unknown event '{eventId}'.";
+ if (!Instruments.ContainsKey(instrumentId)) return $"Unknown instrument '{instrumentId}'.";
+ if (!float.IsFinite(gain) || gain is < 0 or > 1) return "Gain must be between 0 and 1.";
+ return null;
+ }
+
public static readonly IReadOnlyDictionary Events = new DingEvent[]
{
new("session.start", "Opening welcome", [new(0, 0), new(7, 220)]),
diff --git a/tests/AquaSynth.Dsl.Tests/DingCatalogTests.cs b/tests/AquaSynth.Dsl.Tests/DingCatalogTests.cs
index fcec7e5..c8ffd59 100644
--- a/tests/AquaSynth.Dsl.Tests/DingCatalogTests.cs
+++ b/tests/AquaSynth.Dsl.Tests/DingCatalogTests.cs
@@ -9,6 +9,26 @@ public sealed class DingCatalogTests
public void CuratedInstrumentsStayDistinctAndInsidePleasantnessEnvelope() =>
Assert.Empty(DingCatalog.ValidateCuration());
+ [Fact]
+ public void PlayRejectionIsTheHostGateWithPinnedTexts()
+ {
+ Assert.Null(DingCatalog.PlayRejection("task.complete", "warm-bell", 0));
+ Assert.Null(DingCatalog.PlayRejection("task.complete", "warm-bell", 1));
+ Assert.Equal("Unknown event 'nope'.", DingCatalog.PlayRejection("nope", "warm-bell", .5f));
+ Assert.Equal("Unknown instrument 'nope'.", DingCatalog.PlayRejection("task.complete", "nope", .5f));
+ Assert.Equal("Unknown event 'nope'.", DingCatalog.PlayRejection("nope", "nope", 2f));
+ foreach (var gain in new[] { -.01f, 1.01f, float.NaN, float.PositiveInfinity })
+ Assert.Equal("Gain must be between 0 and 1.", DingCatalog.PlayRejection("task.complete", "warm-bell", gain));
+ }
+
+ [Fact]
+ public void HostCallsTheGateAndOwnsNoSecondCopy()
+ {
+ var host = File.ReadAllText(Path.Combine(RepositoryRoot(), "tools", "AquaSynthDingsHost", "DingsPlaybackHost.cs"));
+ Assert.Contains("DingCatalog.PlayRejection(", host, StringComparison.Ordinal);
+ Assert.DoesNotContain("Unknown event", host, StringComparison.Ordinal);
+ }
+
[Fact]
public void MinimalDingsVocabularyIsComplete()
{
diff --git a/tests/AquaSynth.Dsl.Tests/DingsBridgeTests.cs b/tests/AquaSynth.Dsl.Tests/DingsBridgeTests.cs
index 959235d..c46f924 100644
--- a/tests/AquaSynth.Dsl.Tests/DingsBridgeTests.cs
+++ b/tests/AquaSynth.Dsl.Tests/DingsBridgeTests.cs
@@ -31,6 +31,20 @@ public sealed class DingsBridgeTests
Assert.Equal(.7f, host.Commands.Single().Value);
}
+ [Fact]
+ public async Task DeprecatedBridgeFailFastKeepsItsErrorsAndTextsAgreeWithTheHostGate()
+ {
+ var host = new FakeHostClient();
+ var service = new DingService(host);
+
+ var badEvent = await Assert.ThrowsAsync(() => service.PlayAsync("nope", "warm-bell", .5f, CancellationToken.None));
+ Assert.Equal(DingCatalog.PlayRejection("nope", "warm-bell", .5f), badEvent.Message);
+ var badInstrument = await Assert.ThrowsAsync(() => service.PlayAsync("task.complete", "nope", .5f, CancellationToken.None));
+ Assert.Equal(DingCatalog.PlayRejection("task.complete", "nope", .5f), badInstrument.Message);
+ await Assert.ThrowsAsync(() => service.PlayAsync("task.complete", "warm-bell", 1.5f, CancellationToken.None));
+ Assert.Empty(host.Commands);
+ }
+
[Fact]
public void BridgeProjectContainsNoAudioOutputOwner()
{
diff --git a/tools/AquaSynthDingsHost/DingsPlaybackHost.cs b/tools/AquaSynthDingsHost/DingsPlaybackHost.cs
index d0ffae3..afd6843 100644
--- a/tools/AquaSynthDingsHost/DingsPlaybackHost.cs
+++ b/tools/AquaSynthDingsHost/DingsPlaybackHost.cs
@@ -63,9 +63,9 @@ public sealed class DingsPlaybackHost : IAsyncDisposable
private async Task PlayAsync(DingsCommand command, CancellationToken cancellationToken)
{
- if (!DingCatalog.Events.TryGetValue(command.EventId, out var dingEvent)) return Response(false, "rejected", $"Unknown event '{command.EventId}'.");
- if (!DingCatalog.Instruments.TryGetValue(command.InstrumentId, out var instrument)) return Response(false, "rejected", $"Unknown instrument '{command.InstrumentId}'.");
- if (!float.IsFinite(command.Value) || command.Value is < 0 or > 1) return Response(false, "rejected", "Gain must be between 0 and 1.");
+ if (DingCatalog.PlayRejection(command.EventId, command.InstrumentId, command.Value) is { } rejection) return Response(false, "rejected", rejection);
+ var dingEvent = DingCatalog.Events[command.EventId];
+ var instrument = DingCatalog.Instruments[command.InstrumentId];
var playbackId = $"ding-{Guid.NewGuid():N}";
foreach (var note in dingEvent.Notes)
{
diff --git a/tools/AquaSynthDingsMcp/DingService.cs b/tools/AquaSynthDingsMcp/DingService.cs
index 4ca715e..6d53486 100644
--- a/tools/AquaSynthDingsMcp/DingService.cs
+++ b/tools/AquaSynthDingsMcp/DingService.cs
@@ -6,6 +6,9 @@ public sealed class DingService(IDingsHostClient host)
{
public async Task