Skip to content

Commit 2a32c98

Browse files
docs: resolve architecture review findings
1 parent 211efe7 commit 2a32c98

19 files changed

Lines changed: 218 additions & 85 deletions

docs/plans/2026-07-09-tracedecay-brain-rewrite.md

Lines changed: 11 additions & 8 deletions
Large diffs are not rendered by default.

docs/plans/tracedecay-v2/01-domain-crate.md

Lines changed: 65 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,36 @@ pub enum StoreIsolationModeV1 {
206206
RemoteAuthorityOnly,
207207
SameUserDegraded,
208208
}
209-
pub struct StoreIsolationStatusV1 {
210-
pub mode: StoreIsolationModeV1,
211-
pub database_read_denied_to_clients: bool,
212-
pub database_write_denied_to_clients: bool,
213-
pub service_identity_verified: bool,
214-
pub endpoint_acl_verified: bool,
215-
pub key_authority_verified: bool,
216-
pub last_probe_at: UtcMicros,
217-
pub evidence_digest: ManifestDigest,
209+
pub enum StoreIsolationStatusV1 {
210+
DedicatedServiceIdentity {
211+
profile_id: ProfileId,
212+
authority_id: StoreAuthorityId,
213+
authority_epoch: AuthorityEpoch,
214+
proof_generation: u64,
215+
service_identity_receipt: EntityId,
216+
database_root_acl_receipt: EntityId,
217+
endpoint_acl_receipt: EntityId,
218+
key_authority_receipt: EntityId,
219+
verified_at: UtcMicros,
220+
valid_until: UtcMicros,
221+
evidence_digest: ManifestDigest,
222+
},
223+
RemoteAuthorityOnly {
224+
profile_id: ProfileId,
225+
authority_id: StoreAuthorityId,
226+
authority_epoch: AuthorityEpoch,
227+
local_absence_receipt: EntityId,
228+
cache_policy_digest: ManifestDigest,
229+
verified_at: UtcMicros,
230+
valid_until: UtcMicros,
231+
evidence_digest: ManifestDigest,
232+
},
233+
SameUserDegraded {
234+
profile_id: ProfileId,
235+
reason_codes: BoundedVec<RegistryEntryId, 8>,
236+
observed_at: UtcMicros,
237+
evidence_digest: ManifestDigest,
238+
},
218239
}
219240
pub struct ShardId(pub uuid::Uuid);
220241
pub struct PrivacyDomainId(pub uuid::Uuid);
@@ -327,25 +348,53 @@ pub struct ComponentVersion(String); // bounded ASCII semver/build grammar
327348
pub struct TraceDecayBuildRefV1 {
328349
pub version: ComponentVersion,
329350
pub component: RegistryEntryId,
330-
pub build_manifest_digest: Option<ManifestDigest>,
351+
pub build_manifest_digest: ManifestDigest,
331352
}
332353
pub struct ComponentVersionRequirementV1(String); // bounded canonical semver requirement grammar
333-
pub enum TraceDecayVersionSelectionBasisV1 { All, CurrentRuntime, CompatibleProtocol }
354+
pub struct RuntimeBuildSetRefV1 {
355+
pub set_id: EntityId,
356+
pub component_builds_digest: ManifestDigest,
357+
pub member_count: u16,
358+
pub admitted_at: UtcMicros,
359+
}
360+
pub struct RuntimeBuildSetMemberV1 {
361+
pub component: RegistryEntryId,
362+
pub build: TraceDecayBuildRefV1,
363+
}
364+
pub enum TraceDecayVersionSelectionBasisV1 {
365+
All,
366+
CurrentRuntimeSet(RuntimeBuildSetRefV1),
367+
CompatibleProtocol { protocol: ProtocolRef, compatibility_manifest_digest: ManifestDigest },
368+
}
334369
pub enum LegacyUnknownVersionPolicyV1 { Include, Exclude, Only }
335-
pub struct DiagnosticLogEventV1 {
370+
pub struct DiagnosticLogCoreV1 {
336371
pub event_id: EntityId,
337372
pub occurred_at: UtcMicros,
338-
pub producer: TraceDecayBuildRefV1,
339373
pub collector: Option<TraceDecayBuildRefV1>,
340374
pub severity: RegistryEntryId,
341375
pub event_code: RegistryEntryId,
342376
pub correlation_id: Option<EntityId>,
343377
pub safe_message: LogSafeText,
344378
}
379+
pub struct DiagnosticLogEventV1 {
380+
pub core: DiagnosticLogCoreV1,
381+
pub producer: TraceDecayBuildRefV1,
382+
}
383+
pub enum StoredProducerVersionV1 {
384+
KnownExactBuild(TraceDecayBuildRefV1),
385+
KnownVersion { component: RegistryEntryId, version: ComponentVersion, source_manifest_id: ManifestId },
386+
UnknownLegacy { source_manifest_id: ManifestId, reason: RegistryEntryId },
387+
}
388+
pub struct StoredDiagnosticLogRecordV1 {
389+
pub core: DiagnosticLogCoreV1,
390+
pub producer_version: StoredProducerVersionV1,
391+
}
345392
pub struct TraceDecayVersionSelectorV1 {
346393
pub basis: TraceDecayVersionSelectionBasisV1,
394+
pub producer_components: BoundedVec<RegistryEntryId, 16>,
347395
pub include: BoundedVec<ComponentVersionRequirementV1, 16>,
348396
pub exclude: BoundedVec<ComponentVersionRequirementV1, 16>,
397+
pub exact_build_digests: BoundedVec<ManifestDigest, 16>,
349398
pub legacy_unknown: LegacyUnknownVersionPolicyV1,
350399
}
351400
pub struct MediaTypeCode(String); // allowlisted IANA/media grammar, no parameters with literals
@@ -941,7 +990,9 @@ pub struct ModelCapabilityRefV1 {
941990
}
942991
```
943992

944-
`TraceDecayBuildRefV1.version` is required on every newly emitted TraceDecay log event and uses semantic-version precedence with prerelease/build handling; development artifacts use an explicit valid development/build version rather than an empty or inferred value. A forwarder sets `collector` but preserves `producer` byte-for-byte. Multi-line human diagnostics are one typed event or independently version-stamped continuation events. `TraceDecayVersionSelectionBasisV1::CurrentRuntime` resolves against the application server/CLI runtime captured at request admission; `CompatibleProtocol` resolves through the versioned compatibility manifest, never a string-prefix guess. Empty `include` means the selected basis population, then `exclude` subtracts. `LegacyUnknownVersionPolicyV1` exists only to query imported pre-contract records; a new `DiagnosticLogEventV1` cannot represent an unknown version. Metric labels still exclude arbitrary build/version cardinality—version is an indexed diagnostic predicate and evidence boundary, not a free-form metric dimension.
993+
`TraceDecayBuildRefV1.version` and `build_manifest_digest` are required on every newly emitted TraceDecay log event and use semantic-version precedence with prerelease/build handling; development artifacts generate an explicit valid development/build version and manifest digest rather than an empty or inferred value. A forwarder sets `collector` but preserves `producer` byte-for-byte. Multi-line human diagnostics are one typed event or independently version-stamped continuation events. Live emission can construct only `DiagnosticLogEventV1`/`StoredProducerVersionV1::KnownExactBuild`. The importer may construct `KnownVersion` only when the source proves component+SemVer but lacks an exact build manifest, and may construct `UnknownLegacy` only with source manifest and reason; it never fabricates a digest or downgrades proven version evidence. `CurrentRuntimeSet` resolves through immutable persisted `RuntimeBuildSetMemberV1` rows admitted for the requesting daemon session, not one ambiguous CLI or server version; the reference digest/count must rederive exactly and the set remains replayable after process loss. `CompatibleProtocol` binds the exact protocol and compatibility-manifest digest. SemVer requirements operate on normalized parsed precedence; build metadata does not affect precedence and is selectable only through `exact_build_digests`. Empty `producer_components` means every component in the selected basis; empty `include` means the selected basis population, then `exclude` subtracts. Metric labels still exclude arbitrary build/version cardinality—version is an indexed diagnostic predicate and evidence boundary, not a free-form metric dimension.
994+
995+
`StoreIsolationStatusV1` is observed proof, not desired configuration. Each variant contains only evidence legal for that mode and is bound to the profile plus authority epoch where applicable. `database_read_denied_to_clients` and similar UI/API booleans are derived generated view fields: `true` only for an unexpired `DedicatedServiceIdentity` or `RemoteAuthorityOnly` proof, never caller-set state. Plan 20 owns desired `StoreIsolationModeV1`; root/plan 18 owns proof issuance and expiry.
945996

946997
`SavedViewV1` and `SavedViewDefinitionV1` are the one persisted/wire saved-view envelope. Plan 11 owns the UI-neutral `InvestigationStateV1` codec, bounded scene-trail interaction semantics, and `ExperimentViewSpecV1` presentation; plan 24 owns `TaskViewSpecV1` validation/lenses. All three variants live under this domain contract and share identity, name/owner scope, classification/redaction, live/frozen snapshot, optimistic version, expiry, revoke/reauthorize, and sharing lifecycle. Experiment views reference immutable experiment/run/cell/stage/comparison/comparison-cell/reduction/playhead identities and never embed inputs or outputs. A variant cannot introduce another saved-view ID, table, query scope, grant, route family, or command namespace. `PendingSanitization` is an automated safety state, not a human approval queue.
947998

0 commit comments

Comments
 (0)