stabilize tests

This commit is contained in:
master
2026-02-01 21:37:40 +02:00
parent 55744f6a39
commit 5d5e80b2e4
6435 changed files with 33984 additions and 13802 deletions

View File

@@ -1,17 +1,17 @@
# SBOM Service · AGENTS
# SBOM Service ?? AGENTS
## Roles & Scope
- Backend engineer (.NET 10, C# preview) for `src/SbomService/StellaOps.SbomService` and related workers/tests.
- Docs/contract maintainer for SBOM service APIs and events under `docs/modules/sbomservice`.
- Docs/contract maintainer for SBOM service APIs and events under `docs/modules/sbom-service`.
- QA automation for `src/SbomService/__Tests` (unit/integration/golden/property).
- Working directory: `src/SbomService/**`; docs under `docs/modules/sbomservice/**` when touched by sprint tasks.
- Working directory: `src/SbomService/**`; docs under `docs/modules/sbom-service/**` when touched by sprint tasks.
## Required Reading (treat as read before DOING)
- `docs/README.md`
- `docs/07_HIGH_LEVEL_ARCHITECTURE.md`
- `docs/modules/platform/architecture-overview.md`
- `docs/modules/sbomservice/architecture.md`
- Current sprint doc: `docs/implplan/SPRINT_0142_0001_0001_sbomservice.md`
- `docs/modules/sbom-service/architecture.md`
- Current sprint doc: `docs-archived/implplan/SPRINT_0142_0001_0001_sbomservice.md`
## Working Agreements
- Determinism: stable ordering, seeded randomness, UTC ISO-8601, deterministic pagination cursors; no wall-clock in logic/tests.
@@ -27,7 +27,7 @@
- Add/extend golden/property tests for new endpoints, metrics, and event envelopes.
## Documentation & Contracts
- Update `docs/modules/sbomservice/architecture.md` and linked schema/event docs when APIs/events change.
- Update `docs/modules/sbom-service/architecture.md` and linked schema/event docs when APIs/events change.
- Keep Link-Not-Merge (LNM) schema alignment; consume fixtures once provided.
- Surface decisions/risks in sprint doc and mirror in module docs when behavior changes.
@@ -44,3 +44,4 @@
## Allowed Shared Libraries
- Only shared libs already referenced by SbomService projects; do not add new cross-module deps without sprint approval.

View File

@@ -51,7 +51,7 @@ public class SbomInventoryEventsTests : IClassFixture<WebApplicationFactory<Stel
}
[Trait("Category", TestCategories.Unit)]
[Fact(Skip = "Flaky test - passes in isolation but fails when run with other tests due to shared state")]
[Fact]
public async Task Resolver_feed_backfill_populates_candidates()
{
var client = _factory.CreateClient();

View File

@@ -0,0 +1,8 @@
# StellaOps.SbomService.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/SbomService/StellaOps.SbomService.Tests/StellaOps.SbomService.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -1,4 +1,4 @@
# StellaOps.SbomService Agent Charter
# StellaOps.SbomService ??? Agent Charter
## Mission
Expose normalized SBOM projections (components, relationships, scopes, entrypoints) that downstream systems such as Cartographer, Policy Engine, and Scheduler consume. Maintain deterministic SBOM versioning, change events, and tenant-aware access patterns.
@@ -16,8 +16,8 @@ Expose normalized SBOM projections (components, relationships, scopes, entrypoin
## Required Reading
- `docs/modules/platform/architecture-overview.md`
- `docs/modules/sbomservice/architecture.md`
- `docs/implplan/SPRINT_0142_0001_0001_sbomservice.md`
- `docs/modules/sbom-service/architecture.md`
- `docs-archived/implplan/SPRINT_0142_0001_0001_sbomservice.md`
## Working Agreement
- 1. Update task status to `DOING`/`DONE` in both correspoding sprint file `/docs/implplan/SPRINT_*.md` and the local `TASKS.md` when you start or finish work.
@@ -25,3 +25,4 @@ Expose normalized SBOM projections (components, relationships, scopes, entrypoin
- 3. Keep changes deterministic (stable ordering, timestamps, hashes) and align with offline/air-gap expectations.
- 4. Coordinate doc updates, tests, and cross-guild communication whenever contracts or workflows change.
- 5. Revert to `TODO` if you pause the task without shipping changes; leave notes in commit/PR descriptions for context.

View File

@@ -1,7 +1,8 @@
using System.Security.Claims;
using System.Text.Encodings.Web;
using Microsoft.AspNetCore.Authentication;
using Microsoft.Extensions.Options;
using System.Security.Claims;
using System.Text.Encodings.Web;
namespace StellaOps.SbomService.Auth;

View File

@@ -1,9 +1,10 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using System.Security.Claims;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Services;
using System.Security.Claims;
namespace StellaOps.SbomService.Controllers;

View File

@@ -1,6 +1,7 @@
// Copyright (c) StellaOps. Licensed under BUSL-1.1.
// SPRINT_20251229_012 REG-SRC-004: Registry webhook endpoints
using Microsoft.AspNetCore.Mvc;
using StellaOps.SbomService.Services;

View File

@@ -1,15 +1,16 @@
using System.Globalization;
using System.Diagnostics.Metrics;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using StellaOps.SbomService.Auth;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Services;
using StellaOps.SbomService.Observability;
using StellaOps.SbomService.Repositories;
using System.Text.Json;
using StellaOps.SbomService.Services;
using System.Diagnostics;
using System.Diagnostics.Metrics;
using System.Globalization;
using System.Text.Json;
var builder = WebApplication.CreateBuilder(args);

View File

@@ -1,5 +1,6 @@
using System.Text.Json;
using StellaOps.SbomService.Models;
using System.Text.Json;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,5 +1,6 @@
using System.Text.Json;
using StellaOps.SbomService.Models;
using System.Text.Json;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,7 +1,8 @@
using StellaOps.SbomService.Models;
using System.Security.Cryptography;
using System.Text.Json;
using System.Text.Json.Nodes;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,8 +1,9 @@
using System;
using StellaOps.SbomService.Models;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,5 +1,6 @@
using System.Collections.Concurrent;
using StellaOps.SbomService.Models;
using System.Collections.Concurrent;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,5 +1,6 @@
using System.Collections.Concurrent;
using StellaOps.SbomService.Services;
using System.Collections.Concurrent;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,5 +1,6 @@
using System.Collections.Concurrent;
using StellaOps.SbomService.Models;
using System.Collections.Concurrent;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,10 +1,11 @@
using System;
using StellaOps.SbomService.Models;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Repositories;

View File

@@ -4,9 +4,10 @@
// Task: In-memory implementation of SBOM lineage edge repository
// -----------------------------------------------------------------------------
using System.Collections.Concurrent;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Services;
using System.Collections.Concurrent;
namespace StellaOps.SbomService.Repositories;

View File

@@ -1,7 +1,8 @@
using System;
using StellaOps.SbomService.Models;
using System;
using System.Threading;
using System.Threading.Tasks;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Services;

View File

@@ -1,6 +1,7 @@
using System.Threading;
using System.Threading.Tasks;
using StellaOps.SbomService.Models;
using System.Threading;
using System.Threading.Tasks;
namespace StellaOps.SbomService.Services;

View File

@@ -5,11 +5,12 @@
// Description: In-memory implementation of lineage compare cache with TTL.
// -----------------------------------------------------------------------------
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Collections.Concurrent;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace StellaOps.SbomService.Services;

View File

@@ -1,11 +1,12 @@
using System.Collections.Concurrent;
using System.Globalization;
using System.Diagnostics.Metrics;
using System.Text.Json;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Observability;
using StellaOps.SbomService.Repositories;
using StellaOps.SbomService.Services;
using System.Collections.Concurrent;
using System.Diagnostics.Metrics;
using System.Globalization;
using System.Text.Json;
namespace StellaOps.SbomService.Services;
@@ -171,6 +172,7 @@ internal sealed class InMemorySbomQueryService : ISbomQueryService
var cacheKey = $"projection|{snapshotId}|{tenantId}";
if (_cache.TryGetValue(cacheKey, out var cached) && cached is SbomProjectionResult cachedProjection)
{
await PublishProjectionEventsAsync(cachedProjection, cancellationToken).ConfigureAwait(false);
return cachedProjection;
}
@@ -178,40 +180,45 @@ internal sealed class InMemorySbomQueryService : ISbomQueryService
if (projection is not null)
{
_cache[cacheKey] = projection;
var evt = new SbomVersionCreatedEvent(
projection.SnapshotId,
projection.TenantId,
projection.ProjectionHash,
projection.SchemaVersion,
_clock.UtcNow);
await _eventPublisher.PublishVersionCreatedAsync(evt, cancellationToken);
if (TryExtractAsset(projection.Projection, out var asset))
{
var assetEvent = new SbomAssetUpdatedEvent(
projection.SnapshotId,
projection.TenantId,
asset,
projection.ProjectionHash,
projection.SchemaVersion,
_clock.UtcNow);
await _eventPublisher.PublishAssetUpdatedAsync(assetEvent, cancellationToken);
}
foreach (var inv in BuildInventoryEvents(projection.SnapshotId, projection.TenantId))
{
await _eventPublisher.PublishInventoryAsync(inv, cancellationToken);
}
foreach (var candidate in BuildResolverCandidates(projection.SnapshotId, projection.TenantId))
{
await _eventPublisher.PublishResolverAsync(candidate, cancellationToken);
}
await PublishProjectionEventsAsync(projection, cancellationToken).ConfigureAwait(false);
}
return projection;
}
private async Task PublishProjectionEventsAsync(SbomProjectionResult projection, CancellationToken cancellationToken)
{
var evt = new SbomVersionCreatedEvent(
projection.SnapshotId,
projection.TenantId,
projection.ProjectionHash,
projection.SchemaVersion,
_clock.UtcNow);
await _eventPublisher.PublishVersionCreatedAsync(evt, cancellationToken).ConfigureAwait(false);
if (TryExtractAsset(projection.Projection, out var asset))
{
var assetEvent = new SbomAssetUpdatedEvent(
projection.SnapshotId,
projection.TenantId,
asset,
projection.ProjectionHash,
projection.SchemaVersion,
_clock.UtcNow);
await _eventPublisher.PublishAssetUpdatedAsync(assetEvent, cancellationToken).ConfigureAwait(false);
}
foreach (var inv in BuildInventoryEvents(projection.SnapshotId, projection.TenantId))
{
await _eventPublisher.PublishInventoryAsync(inv, cancellationToken).ConfigureAwait(false);
}
foreach (var candidate in BuildResolverCandidates(projection.SnapshotId, projection.TenantId))
{
await _eventPublisher.PublishResolverAsync(candidate, cancellationToken).ConfigureAwait(false);
}
}
private static bool TryExtractAsset(JsonElement projection, out AssetMetadata asset)
{
asset = default!;

View File

@@ -5,11 +5,12 @@
// Description: Implementation of full artifact comparison service.
// -----------------------------------------------------------------------------
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using StellaOps.Excititor.Persistence.Repositories;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using StellaOps.Excititor.Persistence.Repositories;
using System.Diagnostics;
namespace StellaOps.SbomService.Services;

View File

@@ -4,11 +4,12 @@
// Task: Evidence pack export service implementation
// -----------------------------------------------------------------------------
using Microsoft.Extensions.Logging;
using StellaOps.SbomService.Models;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Services;

View File

@@ -4,13 +4,14 @@
// Task: Add Valkey caching for hover card data with 5-minute TTL
// -----------------------------------------------------------------------------
using System.Diagnostics;
using System.ComponentModel.DataAnnotations;
using System.Text.Json;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using StellaOps.SbomService.Models;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Text.Json;
namespace StellaOps.SbomService.Services;

View File

@@ -1,6 +1,7 @@
using StellaOps.SbomService.Repositories;
using System.Collections.Concurrent;
using System.Diagnostics.Metrics;
using StellaOps.SbomService.Repositories;
namespace StellaOps.SbomService.Services;

View File

@@ -1,12 +1,13 @@
// Copyright (c) StellaOps. Licensed under BUSL-1.1.
// SPRINT_20251229_012 REG-SRC-005: Registry discovery service
using System.Net.Http.Headers;
using System.Text.Json;
using System.Text.RegularExpressions;
using Microsoft.Extensions.Options;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System.Net.Http.Headers;
using System.Text.Json;
using System.Text.RegularExpressions;
namespace StellaOps.SbomService.Services;

View File

@@ -1,12 +1,13 @@
// Copyright (c) StellaOps. Licensed under BUSL-1.1.
// SPRINT_20251229_012 REG-SRC-004: Registry webhook ingestion service
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
namespace StellaOps.SbomService.Services;

View File

@@ -7,10 +7,11 @@
// policy_version + vex_verdicts_digest + timestamp)
// -----------------------------------------------------------------------------
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
using Microsoft.Extensions.Logging;
namespace StellaOps.SbomService.Services;

View File

@@ -5,11 +5,12 @@
// Description: Implementation of replay hash verification with drift detection.
// -----------------------------------------------------------------------------
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using Microsoft.Extensions.Logging;
namespace StellaOps.SbomService.Services;

View File

@@ -1,8 +1,9 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace StellaOps.SbomService.Services;

View File

@@ -1,9 +1,10 @@
using StellaOps.SbomService.Models;
using System.Collections.Immutable;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Services;

View File

@@ -1,5 +1,6 @@
using System.Collections.Concurrent;
using StellaOps.SbomService.Models;
using System.Collections.Concurrent;
namespace StellaOps.SbomService.Services;

View File

@@ -1,13 +1,14 @@
using System;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
namespace StellaOps.SbomService.Services;

View File

@@ -5,12 +5,13 @@
// Task: Implement SBOM lineage graph service
// -----------------------------------------------------------------------------
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
using Microsoft.Extensions.Logging;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
namespace StellaOps.SbomService.Services;

View File

@@ -1,9 +1,10 @@
using System;
using StellaOps.SbomService.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.Json;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Services;

View File

@@ -1,7 +1,8 @@
using System;
using StellaOps.SbomService.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Services;

View File

@@ -1,4 +1,6 @@
using System;
using StellaOps.SbomService.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
@@ -7,7 +9,6 @@ using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using StellaOps.SbomService.Models;
namespace StellaOps.SbomService.Services;

View File

@@ -1,12 +1,13 @@
// Copyright (c) StellaOps. Licensed under BUSL-1.1.
// SPRINT_20251229_012 REG-SRC-006: Scan job emission service
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Extensions.Options;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System.Net.Http.Json;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace StellaOps.SbomService.Services;

View File

@@ -5,11 +5,12 @@
// Description: Valkey/Redis implementation of lineage compare cache with 10-minute TTL.
// -----------------------------------------------------------------------------
using System.Diagnostics;
using System.Text.Json;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Diagnostics;
using System.Text.Json;
namespace StellaOps.SbomService.Services;

View File

@@ -0,0 +1,8 @@
# StellaOps.SbomService Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/SbomService/StellaOps.SbomService/StellaOps.SbomService.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -1,8 +1,9 @@
using System.Text.Json;
using Microsoft.Extensions.Logging;
using StellaOps.Infrastructure.Postgres.Repositories;
using StellaOps.SbomService.Lineage.Domain;
using StellaOps.SbomService.Lineage.Persistence;
using System.Text.Json;
namespace StellaOps.SbomService.Lineage.Repositories;

View File

@@ -1,9 +1,10 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using StellaOps.Infrastructure.Postgres.Options;
using StellaOps.SbomService.Repositories;
using StellaOps.SbomService.Persistence.Postgres;
using StellaOps.SbomService.Persistence.Postgres.Repositories;
using StellaOps.SbomService.Repositories;
namespace StellaOps.SbomService.Persistence.Extensions;

View File

@@ -1,9 +1,10 @@
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Npgsql;
using StellaOps.Infrastructure.Postgres.Repositories;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System.Text.Json;
namespace StellaOps.SbomService.Persistence.Postgres.Repositories;

View File

@@ -1,10 +1,11 @@
using System.Security.Cryptography;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Npgsql;
using StellaOps.Infrastructure.Postgres.Repositories;
using StellaOps.SbomService.Models;
using StellaOps.SbomService.Repositories;
using System.Security.Cryptography;
using System.Text.Json;
namespace StellaOps.SbomService.Persistence.Postgres.Repositories;

View File

@@ -4,12 +4,13 @@
// Task: Implement ISbomLineageEdgeRepository with PostgreSQL
// -----------------------------------------------------------------------------
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Npgsql;
using NpgsqlTypes;
using StellaOps.Infrastructure.Postgres.Repositories;
using StellaOps.SbomService.Persistence.Repositories;
using System.Text.Json;
namespace StellaOps.SbomService.Persistence.Postgres.Repositories;

View File

@@ -0,0 +1,8 @@
# StellaOps.SbomService.Persistence Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/SbomService/__Libraries/StellaOps.SbomService.Persistence/StellaOps.SbomService.Persistence.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.SbomService.Lineage.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/SbomService/__Tests/StellaOps.SbomService.Lineage.Tests/StellaOps.SbomService.Lineage.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |

View File

@@ -0,0 +1,8 @@
# StellaOps.SbomService.Persistence.Tests Task Board
This board mirrors active sprint tasks for this module.
Source of truth: `docs/implplan/SPRINT_20260130_002_Tools_csproj_remediation_solid_review.md`.
| Task ID | Status | Notes |
| --- | --- | --- |
| REMED-05 | TODO | Remediation checklist: docs/implplan/audits/csproj-standards/remediation/checklists/src/SbomService/__Tests/StellaOps.SbomService.Persistence.Tests/StellaOps.SbomService.Persistence.Tests.md. |
| REMED-06 | DONE | SOLID review notes captured for SPRINT_20260130_002. |