gunk-dev/the-valley

dcr-62ecc36-signal-contracts.md

sourceb8e46aa6aaccmain's published tip history
6.7 KiB · Rendered
1---
2type: decision
3id: dcr-62ecc36
4status: decided
5title: "Telemetry rides three signal contracts: durable events, lossy metrics, logs retained under declared policy"
6created: 2026-08-05
7source: design conversation, 2026-08-05
8---
9
10# Three signal contracts
11
12Telemetry on the instance's infrastructure is three signal classes, each with its own durability
13contract: domain events are durable and replayable, metrics are lossy by design, and logs are
14retained under declared policy. All three ride the instance's existing infrastructure; the classes
15differ in what each is allowed to lose.
16[architecture.md's event-log bet](../../design/architecture.md#bet-git-as-event-source--a-log-not-a-workflow-engine)
17already holds that per-repo events are durable in git with the bus as a rebuildable projection, and
18that only ephemeral cross-system events — naming metrics in passing — have the bus as their source
19of truth. This node designs what that parenthetical left open, and adds a third class the
20architecture does not name.
21
22## Domain events — durable
23
24Domain events are the class Phase 1 built: schema'd one event type at a time in
25[schema/events.cue](../../../schema/events.cue), carried on the bus's durable stream (JetStream),
26deterministically replayable, and a projection of git. This decision leaves them unchanged. The
27properties that make the bus trustworthy — durability, schemas, replay — belong to this class alone.
28
29## Metrics — lossy by design, decided as a trial
30
31Metrics are rates, latencies, error counts, and resource use. They ride plain subjects on the same
32server, deliberately unpersisted: fire-and-forget, no stream, no pressure on the bus's bounded
33store. Loss of a sample is acceptable, and that acceptance is what distinguishes the class.
34
35This element is decided as a trial. The revisit condition: if the separation fails in practice —
36metrics leaking into durable streams, the vocabulary discipline eroding, or the transport proving
37wrong — the transport is revisited. The class distinctions stand regardless of the transport's fate.
38
39## Logs — retention is a capability, governed by declared policy
40
41Retention is a capability of the system: ingestion and warehousing exist as machinery, and what is
42retained, at what fidelity, for how long, is declared policy — never an implicit property of
43whatever a collector happens to keep. Resources are bounded, and observability data's value decays
44for the loop that consumes it — the observe-orient-decide-act loop the system runs over its own
45signals ([[ida-a006b02]]
46([ida-a006b02-ooda-over-neural-nodes.md](../ideas/ida-a006b02-ooda-over-neural-nodes.md))). A
47default retention strategy ships, and it evolves as use of the data drives efficiencies: the
48retention policy is itself an output the loop tunes, governed like any configuration
49([self-transparency.md](../../design/self-transparency.md)).
50
51The declared-tiers shape already exists in this schema: `#Backup.retention` in
52[schema/valley.cue](../../../schema/valley.cue) declares keep-counts as policy with defaults. The
53same move extends to signals.
54
55Species differ and carry distinct defaults: some signals are already kept indefinitely at negligible
56cost, others are bulky with fast-decaying value. Policy is per species, not one number.
57
58The warehouse technology, the query interface, and whether logs transit the bus at all or ship by
59other means are deliberately open: the decision is that retention is declared, not which machinery
60enforces it. That openness is the design's storage-agnosticism applied to logs — durability attaches
61to project state, not to any one store ([[ida-48c8868]]
62([ida-48c8868-stores-beyond-git.md](../ideas/ida-48c8868-stores-beyond-git.md))), and an
63implementation is a backend ([[ida-b9f646c]]
64([ida-b9f646c-nix-backend-not-substrate.md](../ideas/ida-b9f646c-nix-backend-not-substrate.md))).
65
66No declared retention policy exists today, so what is kept is an accident of each collector's
67machine configuration rather than a decision. Journals on the pilot host rotate under default caps;
68run trajectories persist indefinitely; neither is the outcome of declared policy.
69Retention-by-accident is the gap this decision closes.
70
71## The promotion ladder
72
73Promotion is how value escapes decay: raw signal is retained under the default policy and expires;
74what a detection distills is promoted into a durable, schema'd insight event; what warrants
75permanent memory becomes a graph node. The decay gradient and the promotion ladder are the same
76structure read in two directions. Raw metrics and logs are sensing, not history. The one-history
77property (S4, [user-scenarios.md](../../design/user-scenarios.md#the-rest-of-the-ladder)) is carried
78by promoted insights and the durable event log, never by the firehose.
79
80## The split of concerns
81
82The design states the properties; the instance supplies the machinery. This is the division the
83backup policy already draws: `#Backup` in the host schema declares the durability policy, and the
84installer supplies machine integration. Which warehouse, which collector, which retention storage —
85instance and machine concerns.
86
87## The authentication consequence
88
89[[bd-d853d9c]] ([bd-d853d9c-bus-unauthenticated.md](../bugs/bd-d853d9c-bus-unauthenticated.md))
90gates automated consumers on bus authentication. That fix should carve the subject namespace with
91the class split in mind from the start: domain subjects writable only by the hook and integrator
92identities, metrics subjects writable by machine services. Encoding the two write-authorities in
93subject-level authorization is cheaper now than re-cutting the namespace later.
94
95## Related
96
97- [[ida-b48bded]]
98 ([ida-b48bded-production-dags-and-events.md](../ideas/ida-b48bded-production-dags-and-events.md))
99 — the event frame these contracts ride on.
100- [[ida-b42d112]]
101 ([ida-b42d112-harness-log-is-normalized.md](../ideas/ida-b42d112-harness-log-is-normalized.md)) —
102 a harness's log of an agent run is normalized; normalization is what makes cross-node log
103 retention usable.
104- [requirements.md's Minimal constraint](../../design/requirements.md#constraints) — one server
105 carrying three contracts instead of three systems.
106- [[ida-f16bd96]]
107 ([ida-f16bd96-the-system-observes-itself.md](../ideas/ida-f16bd96-the-system-observes-itself.md))
108 — the system observes itself, the goal these contracts serve.
109
110## Open
111
112- The default retention strategy's actual tiers, per species.
113- What usage signal drives the retention policy's evolution.
114- Whether the offsite depth that protects git data extends to retained signals, and for which
115 species.
116- The warehouse: technology and query interface.
117- Whether logs transit the bus or ship journald-native.
118- What volume the trial's plain subjects sustain on the pilot host before the transport question
119 reopens.