Prevent recursive Gjallar aggregates

This commit is contained in:
Meta Vens 2026-08-24 20:51:02 +02:00
commit ba5ac54e32
3 changed files with 25 additions and 17 deletions

View file

@ -34,7 +34,7 @@ agent clients can lower without recreating membership or layout authority.
```text
Odin accepted provider-state snapshot on Yggdrasil
-> one startup provider advertisement to Odin over CultMesh/RUDP
-> periodically refreshed provider advertisement and aggregate surface to Odin over CultMesh/RUDP
-> Odin accepted provider-state snapshot over CultNet/RUDP
-> display provider selection
-> provider surface extraction

View file

@ -444,6 +444,7 @@ internal sealed class GjallarRenderer : IDisposable
while (!token.IsCancellationRequested)
{
var (catalog, frames) = ReadCultNetSnapshot(transport);
frames.RemoveAll(frame => !IsAggregateInput(frame));
var observedAt = DateTimeOffset.UtcNow;
latestCatalogProviders = catalog.Providers.Count;
latestComposedProviders = frames.Count;
@ -486,6 +487,7 @@ internal sealed class GjallarRenderer : IDisposable
}
}
states.RemoveAll(frame => !IsAggregateInput(frame));
AcceptOverview(BuildGjallarOverview(catalog, states));
latestComposedProviders = states.Count;
MarkCatalogReceiveSuccess(DateTimeOffset.UtcNow);
@ -793,10 +795,16 @@ internal sealed class GjallarRenderer : IDisposable
Volatile.Write(ref latestOverviewSurface, overview.Surface);
}
private static bool IsAggregateInput(ProviderFrame frame) =>
!string.Equals(frame.Provider.Id, "gjallar.overview", StringComparison.OrdinalIgnoreCase);
private static GjallarOverview BuildGjallarOverview(ProviderCatalog catalog, IReadOnlyList<ProviderFrame> frames)
{
var observedAt = DateTimeOffset.UtcNow;
var children = frames.Select(frame => new
var aggregateFrames = frames
.Where(frame => !string.Equals(frame.Provider.Id, "gjallar.overview", StringComparison.OrdinalIgnoreCase))
.ToArray();
var children = aggregateFrames.Select(frame => new
{
id = $"gjallar-interface-{StableId(frame.Provider.Id)}",
kind = "interface",
@ -837,7 +845,7 @@ internal sealed class GjallarRenderer : IDisposable
props = new
{
title = "Gjallar",
summary = $"{frames.Count} provider surfaces",
summary = $"{aggregateFrames.Length} provider surfaces",
marqueeText = catalog.MarqueeText ?? "",
},
children,
@ -845,7 +853,7 @@ internal sealed class GjallarRenderer : IDisposable
assets = Array.Empty<object>(),
},
};
var componentChildren = frames.Select(frame => new EveSurfaceComponent(
var componentChildren = aggregateFrames.Select(frame => new EveSurfaceComponent(
$"gjallar-interface-{StableId(frame.Provider.Id)}",
"interface",
new Dictionary<string, string>(StringComparer.Ordinal)
@ -870,7 +878,7 @@ internal sealed class GjallarRenderer : IDisposable
new Dictionary<string, string>(StringComparer.Ordinal)
{
["title"] = "Gjallar",
["summary"] = $"{frames.Count} provider surfaces",
["summary"] = $"{aggregateFrames.Length} provider surfaces",
["marqueeText"] = catalog.MarqueeText ?? "",
},
componentChildren);
@ -1406,10 +1414,11 @@ internal sealed class GjallarRenderer : IDisposable
DateTimeOffset observedAt)
{
var receiveStatus = EffectiveReceiveStatus(observedAt);
var state = string.Equals(status, "rendered", StringComparison.Ordinal)
? (receiveStatus == "catalog-composed" ? "healthy" : "dependency-unavailable")
: "active";
var detail = $"Gjallar composition {status}; pulses={frames}; catalogProviders={latestCatalogProviders}; composedProviders={latestComposedProviders}; fps={Math.Round(measuredFps, 2)}; receive={receiveStatus}; attempt={lastReceiveAttemptStatus}; failures={consecutiveCatalogReceiveFailures}; lastSuccess={lastSuccessfulCatalogReceiveObservedAt}";
var publicationFailed = string.Equals(idunnRudpPublishStatus, "failed", StringComparison.Ordinal);
var state = receiveStatus == "catalog-composed" && !publicationFailed
? "healthy"
: "dependency-unavailable";
var detail = $"Gjallar composition {status}; pulses={frames}; catalogProviders={latestCatalogProviders}; composedProviders={latestComposedProviders}; fps={Math.Round(measuredFps, 2)}; receive={receiveStatus}; attempt={lastReceiveAttemptStatus}; failures={consecutiveCatalogReceiveFailures}; lastSuccess={lastSuccessfulCatalogReceiveObservedAt}; healthPublication={idunnRudpPublishStatus}";
return new IdunnDaemonHealthRecord
{
DaemonId = config.IdunnDaemon,

View file

@ -27,14 +27,13 @@ surface sources
- Target deployment: Yggdrasil `gjallar-yggdrasil.service`, beside Odin and Idunn.
- Feed: Yggdrasil-local Odin accepted provider-state snapshot over CultNet/RUDP.
- CultCache witness: `/var/lib/gamecult/gjallar/gjallar.service.cc`.
- Current startup respect: Gjallar publishes
`gamecult.eve.provider_advertisement.v1` once to Odin's CultMesh/RUDP
- Current publication: Gjallar periodically publishes its provider
advertisement and typed `gjallar.overview` surface to Odin's CultMesh/RUDP
document ingress. `--odin-cultmesh-rudp` can override the document endpoint;
otherwise it reuses `--odin-cultnet-rudp`.
- Status path: `/var/lib/gamecult/gjallar/status.json`.
- Current cursor input: `/dev/input/mice`, rendered as a framebuffer crosshair.
- Current minimized-panel presentation: a top tab row. Clicking a panel title
minimizes it; clicking its tab restores it.
- Optional framebuffer lowering can read `/dev/input/mice` and present local
cursor/minimized-panel interactions; the Yggdrasil daemon is headless.
- Current marquee input: Odin's provider catalog `marqueeText`, built from the
Stonks securities tape interwoven with ordered VoidBot poem lines. Gjallar
treats each slash-delimited stonk or poetry line as one ordered marquee queue
@ -137,8 +136,8 @@ Sources:
Notcurses has a modern terminal rendering model built around planes, cells, and
piles, plus rich terminal graphics and optional pixel protocols such as Sixel
and Kitty. It is the closest conceptual neighbor for composited terminal
surfaces. Gjallar differs by treating the framebuffer as the primary body and
by making per-pane text resolution part of the compositor contract.
surfaces. Gjallar differs by publishing a renderer-neutral typed aggregate;
text resolution belongs to optional lowerers rather than the daemon contract.
Sources:
@ -168,7 +167,7 @@ Source: `https://en.wikipedia.org/wiki/Linux_framebuffer`
- `GjallarRenderer` owns catalog reads, provider fetches, frame loop, and
telemetry.
- `BuildGjallarSurface` currently builds the in-memory `gjallar.overview`
- `BuildGjallarOverview` currently builds the typed `gjallar.overview`
surface.
- `AabbPacker` owns weighted panel region packing.
- `FontAtlas.ForTextBox` picks a font per panel based on available pixel area