save progress
This commit is contained in:
25
src/__Tests/Graph/StellaOps.Graph.Indexer.Tests/AGENTS.md
Normal file
25
src/__Tests/Graph/StellaOps.Graph.Indexer.Tests/AGENTS.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Graph Indexer Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Maintain deterministic, offline-safe unit tests for Graph Indexer ingestion and transforms.
|
||||
|
||||
## Responsibilities
|
||||
- Keep fixture-based tests aligned with schema expectations.
|
||||
- Avoid global state changes without isolation (env vars, temp paths).
|
||||
- Maintain clear test categorization and fast execution.
|
||||
|
||||
## Required Reading
|
||||
- docs/modules/graph/architecture.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
|
||||
## Definition of Done
|
||||
- Tests are deterministic and do not require network access.
|
||||
- Fixtures remain stable and are copied to output reliably.
|
||||
- Test metadata accurately reflects scope (unit vs integration).
|
||||
|
||||
## Working Agreement
|
||||
- 1. Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- 2. Review required docs before changes.
|
||||
- 3. Prefer fixed IDs/timestamps and isolated temp directories.
|
||||
- 4. Avoid process-wide env var mutations unless isolated.
|
||||
10
src/__Tests/Graph/StellaOps.Graph.Indexer.Tests/TASKS.md
Normal file
10
src/__Tests/Graph/StellaOps.Graph.Indexer.Tests/TASKS.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Graph Indexer Tests Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0355-M | DONE | Maintainability audit for Graph.Indexer.Tests (legacy path). |
|
||||
| AUDIT-0355-T | DONE | Test coverage audit for Graph.Indexer.Tests (legacy path). |
|
||||
| AUDIT-0355-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,26 @@
|
||||
# AirGap Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate offline/air-gap behaviors end-to-end without relying on external networks.
|
||||
|
||||
## Responsibilities
|
||||
- Keep integration tests deterministic and offline-safe.
|
||||
- Ensure offline kit fixtures and simulated flows mirror documented behavior.
|
||||
- Tag tests for CI selection (Integration, Offline, AirGap).
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/airgap/airgap-mode.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.AirGap
|
||||
- Allowed shared projects: src/AirGap, src/Scanner, src/Attestor, src/Cli
|
||||
|
||||
## Testing Expectations
|
||||
- Avoid real network calls; use deterministic monitors/stubs.
|
||||
- Use fixed seeds or deterministic time where assertions depend on timestamps.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Keep fixtures isolated and clean up temp artifacts.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.AirGap Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0362-M | DONE | Maintainability audit for Integration.AirGap. |
|
||||
| AUDIT-0362-T | DONE | Test coverage audit for Integration.AirGap. |
|
||||
| AUDIT-0362-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,26 @@
|
||||
# Determinism Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate deterministic outputs across ingestion, scoring, and evidence pipelines.
|
||||
|
||||
## Responsibilities
|
||||
- Ensure determinism tests use fixed timestamps and ordered inputs.
|
||||
- Maintain golden vectors and determinism manifests for regressions.
|
||||
- Keep test data offline-safe and reproducible.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/risk/determinism.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.Determinism
|
||||
- Allowed shared projects: src/__Tests/__Benchmarks/determinism, src/__Libraries/StellaOps.Testing.Determinism
|
||||
|
||||
## Testing Expectations
|
||||
- Avoid nondeterministic RNG unless seeded.
|
||||
- Prefer canonical JSON and stable ordering in assertions.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Keep fixtures deterministic and avoid ambient time.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.Determinism Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0363-M | DONE | Maintainability audit for Integration.Determinism. |
|
||||
| AUDIT-0363-T | DONE | Test coverage audit for Integration.Determinism. |
|
||||
| AUDIT-0363-A | DONE | Waived (test project). |
|
||||
26
src/__Tests/Integration/StellaOps.Integration.E2E/AGENTS.md
Normal file
26
src/__Tests/Integration/StellaOps.Integration.E2E/AGENTS.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# E2E Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate end-to-end reproducibility across ingest, normalize, decide, attest, bundle, and reverify stages.
|
||||
|
||||
## Responsibilities
|
||||
- Keep E2E tests deterministic with frozen timestamps and stable inputs.
|
||||
- Ensure Testcontainers usage is gated for Docker availability.
|
||||
- Maintain golden baselines and diff tooling for reproducibility diagnostics.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/airgap/airgap-mode.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.E2E
|
||||
- Allowed shared projects: src/__Tests/__Benchmarks/determinism, src/__Tests/fixtures
|
||||
|
||||
## Testing Expectations
|
||||
- Tag tests for Integration and ensure deterministic ordering.
|
||||
- Avoid Guid.NewGuid/DateTime.UtcNow in graph or manifest generation unless fixed or mocked.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Keep fixtures cleaned up and avoid cross-test contamination.
|
||||
10
src/__Tests/Integration/StellaOps.Integration.E2E/TASKS.md
Normal file
10
src/__Tests/Integration/StellaOps.Integration.E2E/TASKS.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.E2E Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0364-M | DONE | Maintainability audit for Integration.E2E. |
|
||||
| AUDIT-0364-T | DONE | Test coverage audit for Integration.E2E. |
|
||||
| AUDIT-0364-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,26 @@
|
||||
# Performance Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate baseline performance characteristics without compromising determinism.
|
||||
|
||||
## Responsibilities
|
||||
- Keep baselines stable and recorded in the baselines directory.
|
||||
- Ensure performance tests avoid nondeterministic timestamps and IDs.
|
||||
- Maintain offline-friendly, deterministic measurement inputs.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/benchmarks/README.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.Performance
|
||||
- Allowed shared projects: src/__Tests/__Benchmarks/baselines
|
||||
|
||||
## Testing Expectations
|
||||
- Avoid Guid.NewGuid/DateTime.UtcNow in baseline artifacts.
|
||||
- Ensure performance tests can be skipped in constrained CI environments.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Keep report outputs deterministic and in the designated output folder.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.Performance Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0365-M | DONE | Maintainability audit for Integration.Performance. |
|
||||
| AUDIT-0365-T | DONE | Test coverage audit for Integration.Performance. |
|
||||
| AUDIT-0365-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,26 @@
|
||||
# Platform Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate platform startup and PostgreSQL-only configurations.
|
||||
|
||||
## Responsibilities
|
||||
- Keep integration tests deterministic and offline-safe.
|
||||
- Ensure Docker/Testcontainers usage is guarded when unavailable.
|
||||
- Avoid nondeterministic state in schemas and records.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/airgap/airgap-mode.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.Platform
|
||||
- Allowed shared projects: src/__Libraries/StellaOps.Infrastructure.Postgres.Testing
|
||||
|
||||
## Testing Expectations
|
||||
- Tag tests for Integration and Platform.
|
||||
- Prefer fixed schema names and deterministic data in migrations.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Clean up schemas and tables created during tests.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.Platform Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0366-M | DONE | Maintainability audit for Integration.Platform. |
|
||||
| AUDIT-0366-T | DONE | Test coverage audit for Integration.Platform. |
|
||||
| AUDIT-0366-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,25 @@
|
||||
# ProofChain Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate end-to-end proof chain generation and verification.
|
||||
|
||||
## Responsibilities
|
||||
- Keep integration tests deterministic (fixed timestamps, stable hashes).
|
||||
- Ensure Testcontainers usage is guarded when Docker is unavailable.
|
||||
- Maintain fixtures and verify proof replay behavior.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.ProofChain
|
||||
- Allowed shared projects: src/Scanner, src/Attestor, src/Policy
|
||||
|
||||
## Testing Expectations
|
||||
- Tag tests for Integration and ProofChain.
|
||||
- Avoid DateTime.UtcNow in SBOM generation; prefer fixed timestamps.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Clean up any state in the database after test runs.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.ProofChain Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0367-M | DONE | Maintainability audit for Integration.ProofChain. |
|
||||
| AUDIT-0367-T | DONE | Test coverage audit for Integration.ProofChain. |
|
||||
| AUDIT-0367-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,25 @@
|
||||
# Reachability Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate reachability corpus parsing and reachability evidence semantics.
|
||||
|
||||
## Responsibilities
|
||||
- Keep corpus-driven tests deterministic and fixtures validated.
|
||||
- Ensure missing corpus data produces explicit skips or failures as intended.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/scanner/architecture.md
|
||||
- docs/reachability/README.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.Reachability
|
||||
- Allowed shared projects: src/__Tests/reachability
|
||||
|
||||
## Testing Expectations
|
||||
- Avoid silent returns; use explicit skip messages if corpus missing.
|
||||
- Ensure ground-truth assertions validate both reachable and unreachable cases.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Keep fixture paths deterministic and avoid environment-specific behavior.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.Reachability Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0368-M | DONE | Maintainability audit for Integration.Reachability. |
|
||||
| AUDIT-0368-T | DONE | Test coverage audit for Integration.Reachability. |
|
||||
| AUDIT-0368-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,29 @@
|
||||
# Unknowns Integration Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate unknowns detection, ranking, escalation, and resolution workflows.
|
||||
|
||||
## Responsibilities
|
||||
- Keep tests aligned with Policy.Unknowns and Policy.Scoring behavior.
|
||||
- Avoid local mock implementations that drift from production.
|
||||
- Keep time usage deterministic and avoid flaky time windows.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/policy/architecture.md
|
||||
- docs/uncertainty/README.md
|
||||
- docs/api/unknowns-api.md
|
||||
- docs/product-advisories/14-Dec-2025 - Triage and Unknowns Technical Reference.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/Integration/StellaOps.Integration.Unknowns
|
||||
- Allowed shared projects: src/Policy/__Libraries/StellaOps.Policy.Unknowns, src/Policy/StellaOps.Policy.Scoring
|
||||
|
||||
## Testing Expectations
|
||||
- Prefer exercising production ranker and workflow types over local stand-ins.
|
||||
- Use fixed timestamps for assertions and avoid DateTimeOffset.UtcNow in expected values.
|
||||
- Ensure tests remain offline-friendly (no network calls).
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Keep fixture and test data deterministic and repository-local.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Integration.Unknowns Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0369-M | DONE | Maintainability audit for Integration.Unknowns. |
|
||||
| AUDIT-0369-T | DONE | Test coverage audit for Integration.Unknowns. |
|
||||
| AUDIT-0369-A | DONE | Waived (test project). |
|
||||
@@ -0,0 +1,77 @@
|
||||
using StellaOps.Cryptography;
|
||||
using StellaOps.TestKit;
|
||||
|
||||
namespace StellaOps.Audit.ReplayToken.Tests;
|
||||
|
||||
public sealed class DecisionReplayTokenExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void GenerateForDecision_MatchesManualRequest()
|
||||
{
|
||||
var generator = CreateGenerator();
|
||||
|
||||
var token = generator.GenerateForDecision(
|
||||
alertId: "alert-1",
|
||||
actorId: "actor-9",
|
||||
decisionStatus: "approved",
|
||||
evidenceHashes: new[] { "sha256:evidence1" },
|
||||
policyContext: "ctx",
|
||||
rulesVersion: "rules-v1");
|
||||
|
||||
var request = new ReplayTokenRequest
|
||||
{
|
||||
InputHashes = new[] { "alert-1" },
|
||||
EvidenceHashes = new[] { "sha256:evidence1" },
|
||||
RulesVersion = "rules-v1",
|
||||
AdditionalContext = new Dictionary<string, string>
|
||||
{
|
||||
["actor_id"] = "actor-9",
|
||||
["decision_status"] = "approved",
|
||||
["policy_context"] = "ctx"
|
||||
}
|
||||
};
|
||||
|
||||
var expected = generator.Generate(request);
|
||||
|
||||
Assert.Equal(expected.Value, token.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateForScoring_MatchesManualRequest()
|
||||
{
|
||||
var generator = CreateGenerator();
|
||||
|
||||
var token = generator.GenerateForScoring(
|
||||
subjectKey: "subject-1",
|
||||
feedManifests: new[] { "sha256:feed1", "sha256:feed2" },
|
||||
scoringConfigVersion: "score-v1",
|
||||
inputHashes: new[] { "sha256:input1" });
|
||||
|
||||
var request = new ReplayTokenRequest
|
||||
{
|
||||
FeedManifests = new[] { "sha256:feed1", "sha256:feed2" },
|
||||
ScoringConfigVersion = "score-v1",
|
||||
InputHashes = new[] { "sha256:input1" },
|
||||
AdditionalContext = new Dictionary<string, string>
|
||||
{
|
||||
["subject_key"] = "subject-1"
|
||||
}
|
||||
};
|
||||
|
||||
var expected = generator.Generate(request);
|
||||
|
||||
Assert.Equal(expected.Value, token.Value);
|
||||
}
|
||||
|
||||
private static Sha256ReplayTokenGenerator CreateGenerator()
|
||||
{
|
||||
var cryptoHash = DefaultCryptoHash.CreateForTests();
|
||||
var timeProvider = new FixedTimeProvider(new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero));
|
||||
return new Sha256ReplayTokenGenerator(cryptoHash, timeProvider);
|
||||
}
|
||||
|
||||
private sealed class FixedTimeProvider(DateTimeOffset now) : TimeProvider
|
||||
{
|
||||
public override DateTimeOffset GetUtcNow() => now;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using FluentAssertions;
|
||||
|
||||
namespace StellaOps.Audit.ReplayToken.Tests;
|
||||
|
||||
public sealed class ReplayCliSnippetGeneratorTests
|
||||
{
|
||||
[Fact]
|
||||
public void GenerateDecisionReplay_QuotesValuesAndOmitsPlus()
|
||||
{
|
||||
var generator = new ReplayCliSnippetGenerator();
|
||||
var token = new ReplayToken("abc123", DateTimeOffset.UnixEpoch);
|
||||
|
||||
var output = generator.GenerateDecisionReplay(
|
||||
token,
|
||||
"alert 1",
|
||||
"file:///tmp/with space",
|
||||
"policy v1");
|
||||
|
||||
output.Should().Contain("--token 'abc123'");
|
||||
output.Should().Contain("--alert-id 'alert 1'");
|
||||
output.Should().Contain("--feed-manifest 'file:///tmp/with space'");
|
||||
output.Should().Contain("--policy-version 'policy v1'");
|
||||
output.Should().NotContain("\n+");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateScoringReplay_EscapesSingleQuotes()
|
||||
{
|
||||
var generator = new ReplayCliSnippetGenerator();
|
||||
var token = new ReplayToken("abc123", DateTimeOffset.UnixEpoch);
|
||||
|
||||
var output = generator.GenerateScoringReplay(token, "subject'key", "config'v1");
|
||||
|
||||
output.Should().Contain("--subject 'subject'\"'\"'key'");
|
||||
output.Should().Contain("--config-version 'config'\"'\"'v1'");
|
||||
}
|
||||
}
|
||||
@@ -95,6 +95,96 @@ public sealed class ReplayTokenGeneratorTests
|
||||
Assert.False(generator.Verify(token, different));
|
||||
}
|
||||
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Generate_IgnoresAdditionalContextOrdering()
|
||||
{
|
||||
var cryptoHash = DefaultCryptoHash.CreateForTests();
|
||||
var timeProvider = new FixedTimeProvider(new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero));
|
||||
|
||||
var generator = new Sha256ReplayTokenGenerator(cryptoHash, timeProvider);
|
||||
|
||||
var requestA = new ReplayTokenRequest
|
||||
{
|
||||
InputHashes = new[] { "sha256:input" },
|
||||
AdditionalContext = new Dictionary<string, string>
|
||||
{
|
||||
["a"] = "1",
|
||||
["b"] = "2"
|
||||
}
|
||||
};
|
||||
|
||||
var requestB = new ReplayTokenRequest
|
||||
{
|
||||
InputHashes = new[] { "sha256:input" },
|
||||
AdditionalContext = new Dictionary<string, string>
|
||||
{
|
||||
["b"] = "2",
|
||||
["a"] = "1"
|
||||
}
|
||||
};
|
||||
|
||||
var tokenA = generator.Generate(requestA);
|
||||
var tokenB = generator.Generate(requestB);
|
||||
|
||||
Assert.Equal(tokenA.Value, tokenB.Value);
|
||||
}
|
||||
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Generate_DuplicateAdditionalContextKeys_Throws()
|
||||
{
|
||||
var cryptoHash = DefaultCryptoHash.CreateForTests();
|
||||
var timeProvider = new FixedTimeProvider(new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero));
|
||||
|
||||
var generator = new Sha256ReplayTokenGenerator(cryptoHash, timeProvider);
|
||||
|
||||
var request = new ReplayTokenRequest
|
||||
{
|
||||
InputHashes = new[] { "sha256:input" },
|
||||
AdditionalContext = new Dictionary<string, string>
|
||||
{
|
||||
["key"] = "1",
|
||||
[" key "] = "2"
|
||||
}
|
||||
};
|
||||
|
||||
Assert.Throws<ArgumentException>(() => generator.Generate(request));
|
||||
}
|
||||
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void GenerateWithExpiration_UsesDistinctCanonicalVersion()
|
||||
{
|
||||
var cryptoHash = DefaultCryptoHash.CreateForTests();
|
||||
var timeProvider = new FixedTimeProvider(new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero));
|
||||
|
||||
var generator = new Sha256ReplayTokenGenerator(cryptoHash, timeProvider);
|
||||
var request = new ReplayTokenRequest { InputHashes = new[] { "sha256:input" } };
|
||||
|
||||
var v1Token = generator.Generate(request);
|
||||
var v2Token = generator.GenerateWithExpiration(request, TimeSpan.FromMinutes(5));
|
||||
|
||||
Assert.NotEqual(v1Token.Value, v2Token.Value);
|
||||
}
|
||||
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData(0)]
|
||||
[InlineData(-1)]
|
||||
public void GenerateWithExpiration_NonPositiveExpiration_Throws(int seconds)
|
||||
{
|
||||
var cryptoHash = DefaultCryptoHash.CreateForTests();
|
||||
var timeProvider = new FixedTimeProvider(new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero));
|
||||
|
||||
var generator = new Sha256ReplayTokenGenerator(cryptoHash, timeProvider);
|
||||
var request = new ReplayTokenRequest { InputHashes = new[] { "sha256:input" } };
|
||||
|
||||
var expiration = TimeSpan.FromSeconds(seconds);
|
||||
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => generator.GenerateWithExpiration(request, expiration));
|
||||
}
|
||||
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ReplayToken_Parse_RoundTripsCanonical()
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# Infrastructure Postgres Testing Agent Charter
|
||||
|
||||
## Mission
|
||||
- Provide deterministic PostgreSQL integration test fixtures and helpers for module tests.
|
||||
|
||||
## Responsibilities
|
||||
- Maintain Testcontainers setup, schema isolation, and migration helpers.
|
||||
- Keep skip behavior safe when Docker/Testcontainers are unavailable.
|
||||
- Align defaults with StellaOps.Infrastructure.Postgres and devops Postgres settings.
|
||||
|
||||
## Required Reading
|
||||
- docs/modules/platform/architecture-overview.md
|
||||
- docs/db/README.md
|
||||
- src/__Libraries/StellaOps.Infrastructure.Postgres/AGENTS.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/__Libraries/StellaOps.Infrastructure.Postgres.Testing
|
||||
- Allowed shared libs/tests: src/__Libraries/StellaOps.Infrastructure.Postgres, src/__Libraries/__Tests/StellaOps.Infrastructure.Postgres.Tests
|
||||
|
||||
## Determinism & Guardrails
|
||||
- Use fixed schema naming or deterministic suffixes for repeatable logs.
|
||||
- Keep SQL and fixture behavior deterministic (UTC, stable ordering, no random defaults in assertions).
|
||||
- Pin or allow override of the Postgres container image; avoid network calls beyond container startup.
|
||||
|
||||
## Testing Expectations
|
||||
- Provide smoke tests or usage samples for fixtures where feasible.
|
||||
- Test collections must serialize when sharing a database.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Avoid non-ASCII log output and keep error messages actionable.
|
||||
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Infrastructure.Postgres.Testing Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0359-M | DONE | Maintainability audit for Infrastructure.Postgres.Testing. |
|
||||
| AUDIT-0359-T | DONE | Test coverage audit for Infrastructure.Postgres.Testing. |
|
||||
| AUDIT-0359-A | DONE | Waived (test project). |
|
||||
27
src/__Tests/interop/StellaOps.Interop.Tests/AGENTS.md
Normal file
27
src/__Tests/interop/StellaOps.Interop.Tests/AGENTS.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Interop Tests Agent Charter
|
||||
|
||||
## Mission
|
||||
- Validate SBOM interoperability and parity against external tooling.
|
||||
|
||||
## Responsibilities
|
||||
- Keep tests deterministic and offline-friendly where possible.
|
||||
- Use explicit skips when required tools or credentials are missing.
|
||||
- Avoid local reimplementations that drift from production libraries.
|
||||
|
||||
## Required Reading
|
||||
- docs/07_HIGH_LEVEL_ARCHITECTURE.md
|
||||
- docs/modules/scanner/architecture.md
|
||||
- docs/benchmarks/competitive-implementation-milestones.md
|
||||
|
||||
## Working Directory & Scope
|
||||
- Primary: src/__Tests/interop/StellaOps.Interop.Tests
|
||||
- Allowed shared projects: src/__Libraries/StellaOps.Interop
|
||||
|
||||
## Testing Expectations
|
||||
- Use test SDK and framework packages so tests run in CI.
|
||||
- Keep external tool invocations isolated and gated by environment checks.
|
||||
- Avoid silent returns; report skip reasons explicitly.
|
||||
|
||||
## Working Agreement
|
||||
- Update sprint status in docs/implplan/SPRINT_*.md and local TASKS.md.
|
||||
- Keep fixtures and outputs deterministic and repository-local.
|
||||
10
src/__Tests/interop/StellaOps.Interop.Tests/TASKS.md
Normal file
10
src/__Tests/interop/StellaOps.Interop.Tests/TASKS.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# StellaOps.Interop.Tests Task Board
|
||||
|
||||
This board mirrors active sprint tasks for this module.
|
||||
Source of truth: `docs/implplan/SPRINT_20251229_049_BE_csproj_audit_maint_tests.md`.
|
||||
|
||||
| Task ID | Status | Notes |
|
||||
| --- | --- | --- |
|
||||
| AUDIT-0371-M | DONE | Maintainability audit for StellaOps.Interop.Tests. |
|
||||
| AUDIT-0371-T | DONE | Test coverage audit for StellaOps.Interop.Tests. |
|
||||
| AUDIT-0371-A | DONE | Waived (test project). |
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace StellaOps.AuditPack.Tests;
|
||||
|
||||
using StellaOps.AuditPack.Services;
|
||||
|
||||
namespace StellaOps.AuditPack.Tests;
|
||||
|
||||
[Trait("Category", "Unit")]
|
||||
public class AuditPackImporterTests
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user