feat: Implement Runtime Facts ingestion service and NDJSON reader
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Added RuntimeFactsNdjsonReader for reading NDJSON formatted runtime facts. - Introduced IRuntimeFactsIngestionService interface and its implementation. - Enhanced Program.cs to register new services and endpoints for runtime facts. - Updated CallgraphIngestionService to include CAS URI in stored artifacts. - Created RuntimeFactsValidationException for validation errors during ingestion. - Added tests for RuntimeFactsIngestionService and RuntimeFactsNdjsonReader. - Implemented SignalsSealedModeMonitor for compliance checks in sealed mode. - Updated project dependencies for testing utilities.
This commit is contained in:
@@ -7,15 +7,18 @@ namespace StellaOps.Signals.Models;
|
||||
/// </summary>
|
||||
public sealed class CallgraphArtifactMetadata
|
||||
{
|
||||
[BsonElement("path")]
|
||||
public string Path { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("hash")]
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("contentType")]
|
||||
public string ContentType { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("path")]
|
||||
public string Path { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("hash")]
|
||||
public string Hash { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("casUri")]
|
||||
public string CasUri { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("contentType")]
|
||||
public string ContentType { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("length")]
|
||||
public long Length { get; set; }
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ namespace StellaOps.Signals.Models;
|
||||
/// <summary>
|
||||
/// Response returned after callgraph ingestion.
|
||||
/// </summary>
|
||||
public sealed record CallgraphIngestResponse(
|
||||
string CallgraphId,
|
||||
string ArtifactPath,
|
||||
string ArtifactHash);
|
||||
public sealed record CallgraphIngestResponse(
|
||||
string CallgraphId,
|
||||
string ArtifactPath,
|
||||
string ArtifactHash,
|
||||
string CasUri);
|
||||
|
||||
@@ -23,6 +23,10 @@ public sealed class ReachabilityFactDocument
|
||||
[BsonElement("states")]
|
||||
public List<ReachabilityStateDocument> States { get; set; } = new();
|
||||
|
||||
[BsonElement("runtimeFacts")]
|
||||
[BsonIgnoreIfNull]
|
||||
public List<RuntimeFactDocument>? RuntimeFacts { get; set; }
|
||||
|
||||
[BsonElement("metadata")]
|
||||
[BsonIgnoreIfNull]
|
||||
public Dictionary<string, string?>? Metadata { get; set; }
|
||||
@@ -96,3 +100,24 @@ public sealed class ReachabilitySubject
|
||||
return string.Join('|', Component ?? string.Empty, Version ?? string.Empty).Trim('|');
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RuntimeFactDocument
|
||||
{
|
||||
[BsonElement("symbolId")]
|
||||
public string SymbolId { get; set; } = string.Empty;
|
||||
|
||||
[BsonElement("codeId")]
|
||||
[BsonIgnoreIfNull]
|
||||
public string? CodeId { get; set; }
|
||||
|
||||
[BsonElement("loaderBase")]
|
||||
[BsonIgnoreIfNull]
|
||||
public string? LoaderBase { get; set; }
|
||||
|
||||
[BsonElement("hitCount")]
|
||||
public int HitCount { get; set; }
|
||||
|
||||
[BsonElement("metadata")]
|
||||
[BsonIgnoreIfNull]
|
||||
public Dictionary<string, string?>? Metadata { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace StellaOps.Signals.Models;
|
||||
|
||||
public sealed class RuntimeFactsIngestRequest
|
||||
{
|
||||
[Required]
|
||||
public ReachabilitySubject Subject { get; set; } = new();
|
||||
|
||||
[Required]
|
||||
public string CallgraphId { get; set; } = string.Empty;
|
||||
|
||||
public List<RuntimeFactEvent> Events { get; set; } = new();
|
||||
|
||||
public Dictionary<string, string?>? Metadata { get; set; }
|
||||
}
|
||||
|
||||
public sealed class RuntimeFactEvent
|
||||
{
|
||||
[Required]
|
||||
public string SymbolId { get; set; } = string.Empty;
|
||||
|
||||
public string? CodeId { get; set; }
|
||||
|
||||
public string? LoaderBase { get; set; }
|
||||
|
||||
public int HitCount { get; set; } = 1;
|
||||
|
||||
public Dictionary<string, string?>? Metadata { get; set; }
|
||||
}
|
||||
|
||||
public sealed class RuntimeFactsIngestResponse
|
||||
{
|
||||
public string FactId { get; init; } = string.Empty;
|
||||
|
||||
public string SubjectKey { get; init; } = string.Empty;
|
||||
|
||||
public string CallgraphId { get; init; } = string.Empty;
|
||||
|
||||
public int RuntimeFactCount { get; init; }
|
||||
|
||||
public int TotalHitCount { get; init; }
|
||||
|
||||
public DateTimeOffset StoredAt { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace StellaOps.Signals.Models;
|
||||
|
||||
public sealed class RuntimeFactsStreamMetadata
|
||||
{
|
||||
public string CallgraphId { get; set; } = string.Empty;
|
||||
|
||||
public string? ScanId { get; set; }
|
||||
|
||||
public string? ImageDigest { get; set; }
|
||||
|
||||
public string? Component { get; set; }
|
||||
|
||||
public string? Version { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user