diff --git a/README.md b/README.md
index 4d40ed7..73c5f97 100644
--- a/README.md
+++ b/README.md
@@ -431,7 +431,8 @@ The host-start refusal is not a missing switch. A NativeAOT binary has no
reflection-based JSON resolver to fall back on, and the fallback it would need is
the thing the runtime refuses. So the wire shapes have to be **types** before a
contract can be compiled for them. Counted in `dotnet/OpenWaf.Edge` on
-2026-10-06: **130 anonymous object literals** in the JSON path, in **51 distinct
+2026-10-07 with a string-aware scanner (braces inside interpolated strings are
+not braces in the code): **144 anonymous-object literals**, in **27 distinct
shapes**, of which **111 are the one shape `new { error = … }`**. A source
generator cannot describe an anonymous type at all, so those 111 became one
named record — `ErrorDto` — and `Admin/EdgeJson.cs` is now the edge's
@@ -453,8 +454,8 @@ learn:
fails on a *JIT* build with the same sentence the AOT probe reports
(`JsonTypeInfo metadata for type '<>f__AnonymousType0` `` `1[System.String]' was
not provided by TypeInfoResolver of type '[EdgeJson]'` `, from a standalone
- probe). Eighteen anonymous literals are still standing, so on a build that can
- reflect, reflection stays at the end of the chain: the debt kept served and
+ probe). Thirty-one anonymous literals are still standing, so on a build that
+ can reflect, reflection stays at the end of the chain: the debt kept served and
visible rather than a break smuggled into a slice.
* **That fallback is not free on the other side.** Naming
`DefaultJsonTypeInfoResolver` in an AOT publish pulls the reflection-based JSON
@@ -482,9 +483,16 @@ What is **not** measured on this tree: whether the AOT edge now reaches
`Now listening`. The rebuild that would answer it was interrupted, and the answer
is the reason the probe now prints `lines where the edge started listening` —
a 0 means the host still dies before serving, a 1 means it serves. The remaining
-**18 anonymous literals, in 50 distinct shapes**, are what stands between the
+**31 anonymous literals, in 25 distinct shapes**, are what stands between the
two, and they are the next cut.
+The first version of this section carried **130 literals in 51 shapes**, and
+`fb75890` repeats those figures in its message. They came from a first-pass
+scanner that walked braces without skipping string literals, so every `{` inside
+a `$"…{x}…"` was counted as code. The numbers above are the same tree re-measured
+with a scanner that skips strings, char literals and comments; the 111 that became
+`ErrorDto` is the one figure both scanners agree on.
+
## Schema
Migrations are the schema of record for PostgreSQL, which is the provider a
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index 4e2b5c2..f950385 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -119,15 +119,17 @@ classifies the status, and is the only thing that can create an engine ban.
opens a port.
**The API half, first cut (2026-10-07).** A source generator cannot describe an
- anonymous type, and the edge's wire shapes were largely anonymous: **130
- anonymous object literals** in `OpenWaf.Edge`, **51 distinct shapes**, **111 of
- them the single shape `new { error = … }`**. Those 111 are now one named record
+ anonymous type, and the edge's wire shapes were largely anonymous: **144
+ anonymous-object literals** in `OpenWaf.Edge`, **27 distinct shapes**, **111 of
+ them the single shape `new { error = … }`** (string-aware count, 2026-10-07;
+ the first pass reported 130 in 51 because it counted braces inside interpolated
+ strings as code). Those 111 are now one named record
(`ErrorDto`), and `Admin/EdgeJson.cs` is the edge's `JsonSerializerContext` —
24 registered types, `[JsonSourceGenerationOptions(PropertyNamingPolicy =
CamelCase)]` because the generated contract carries the property names and the
whole API reads `error`, not `Error` — registered at the head of the resolver
- chain in `Program.cs`. **18 anonymous literals in 50 shapes remain**, and they
- are the rest of this wall. Two facts about the wiring are load-bearing and were
+ chain in `Program.cs`. **31 anonymous literals in 25 shapes remain**, and
+ they are the rest of this wall. Two facts about the wiring are load-bearing and were
measured, not assumed: a non-empty `TypeInfoResolverChain` **replaces** the
reflection resolver rather than extending it (so an unregistered type breaks on
a JIT build too, with the same sentence the AOT probe reports), and naming
diff --git a/dotnet/OpenWaf.Edge/Admin/AdminDtos.cs b/dotnet/OpenWaf.Edge/Admin/AdminDtos.cs
index c040dd3..3a2ebcb 100644
--- a/dotnet/OpenWaf.Edge/Admin/AdminDtos.cs
+++ b/dotnet/OpenWaf.Edge/Admin/AdminDtos.cs
@@ -170,6 +170,12 @@ internal sealed record ObservationDto(
string? LastCountryCode,
string? LastCity);
+/// One country in the countries summary: how many sources the edge saw
+/// there and how many refusals they account for. Named because the response needs
+/// a compiled JSON contract; the anonymous shape EF translates stays inside the
+/// query (see the countries/summary endpoint).
+internal sealed record CountrySummaryDto(string Code, int Sources, int Refusals);
+
/// The edge's one error body: {"error": "…"}.
///
/// It used to be written 111 times as the anonymous literal new { error = … }.
diff --git a/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs b/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs
index 04710a1..c5676b6 100644
--- a/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs
+++ b/dotnet/OpenWaf.Edge/Admin/AdminEndpoints.cs
@@ -817,7 +817,17 @@ internal static partial class AdminEndpoints
.GroupBy(o => o.LastCountryCode)
.Select(g => new { Code = g.Key, Sources = g.Count(), Refusals = g.Sum(o => o.TotalRefusals) })
.ToListAsync(ct);
- return Results.Ok(rows.OrderByDescending(r => r.Sources));
+ // The anonymous shape has to survive the query and stop at the query:
+ // it is what EF translates, and the record-constructor form fails at
+ // query time with "could not be translated" (measured by a test). The
+ // wire shape is a named type, so the response has a compiled contract
+ // and the sort stays where it was — after translation.
+ // `Code` is nullable in the model and non-null in these rows: the
+ // query filters `LastCountryCode != null`, which the compiler cannot
+ // see and EF does apply.
+ return Results.Ok(rows
+ .Select(r => new CountrySummaryDto(r.Code!, r.Sources, r.Refusals))
+ .OrderByDescending(r => r.Sources));
});
group.MapGet("/geo", (IGeoIpLookup geo, HttpContext ctx) =>
@@ -1774,9 +1784,8 @@ note = t.Note
if (!TryKnownQuery(ctx, out var unknown, "match", "path", "limit"))
return Results.BadRequest(new ErrorDto(unknown));
if (string.IsNullOrWhiteSpace(match))
- return Results.BadRequest(new {
- error = "match is required: an address or a CIDR, the same value the write takes"
- });
+ return Results.BadRequest(new ErrorDto(
+ "match is required: an address or a CIDR, the same value the write takes"));
// Normalised by the write path's own code, so the preview answers
// about the row the write would create and refuses a match the write
// would refuse, in the write's words. 198.51.100.37/24 and
diff --git a/dotnet/OpenWaf.Edge/Admin/EdgeJson.cs b/dotnet/OpenWaf.Edge/Admin/EdgeJson.cs
index 2042b8e..35c5c32 100644
--- a/dotnet/OpenWaf.Edge/Admin/EdgeJson.cs
+++ b/dotnet/OpenWaf.Edge/Admin/EdgeJson.cs
@@ -48,6 +48,7 @@ namespace OpenWaf.Edge.Admin;
[JsonSerializable(typeof(RateSourceDto))]
[JsonSerializable(typeof(ObservationDto))]
[JsonSerializable(typeof(StreakDto))]
+[JsonSerializable(typeof(CountrySummaryDto))]
[JsonSerializable(typeof(HistoryEvent))]
[JsonSerializable(typeof(HorizonRow))]
[JsonSerializable(typeof(HorizonAfter))]