Files
git.stella-ops.org/docs/features/checked/graph/graph-indexer-clustering-and-centrality-background-jobs.md
2026-02-11 01:32:14 +02:00

99 lines
6.5 KiB
Markdown

# Graph Indexer Clustering and Centrality Background Jobs
## Module
Graph
## Status
VERIFIED
## Description
Background hosted service that runs graph analytics (Louvain community detection, betweenness/closeness centrality) on the dependency graph, producing cluster assignments and centrality scores for risk prioritization.
## Implementation Details
- **Hosted service**: `src/Graph/StellaOps.Graph.Indexer/Analytics/GraphAnalyticsHostedService.cs` -- background service that schedules clustering and centrality jobs
- **Analytics engine**: `src/Graph/StellaOps.Graph.Indexer/Analytics/GraphAnalyticsEngine.cs` -- Louvain community detection and betweenness/closeness centrality algorithms
- **Analytics pipeline**: `src/Graph/StellaOps.Graph.Indexer/Analytics/GraphAnalyticsPipeline.cs` -- orchestrates multi-stage analytics (clustering -> centrality -> export)
- **Analytics types**: `src/Graph/StellaOps.Graph.Indexer/Analytics/GraphAnalyticsTypes.cs` -- `ClusterAssignment`, centrality score models
- **Metrics**: `src/Graph/StellaOps.Graph.Indexer/Analytics/GraphAnalyticsMetrics.cs` -- job execution metrics (duration, cluster count, centrality stats)
- **Options**: `src/Graph/StellaOps.Graph.Indexer/Analytics/GraphAnalyticsOptions.cs` -- configurable job intervals and algorithm parameters
- **Snapshot provider**: `src/Graph/StellaOps.Graph.Indexer/Analytics/InMemoryGraphSnapshotProvider.cs` -- provides graph snapshot for analytics input
- **Postgres writer**: `src/Graph/__Libraries/StellaOps.Graph.Indexer.Persistence/Postgres/Repositories/PostgresGraphAnalyticsWriter.cs` -- persists cluster and centrality results
- **Tests**: `src/Graph/__Tests/StellaOps.Graph.Indexer.Tests/GraphAnalyticsEngineTests.cs`, `GraphAnalyticsPipelineTests.cs`
- **Source**: SPRINT_0141_0001_0001_graph_indexer.md
## E2E Test Plan
- [x] Verify Louvain community detection produces stable cluster assignments
- [x] Test betweenness and closeness centrality score computation
- [x] Verify background service runs on configured schedule
- [ ] Test analytics results are persisted to PostgreSQL (skipped: Docker unavailable)
- [x] Verify metrics are emitted for job duration and cluster counts
## Verification
- **Run ID**: run-001
- **Date**: 2026-02-09T16:00:00Z
- **Tier**: 1 (Build + Test)
- **Result**: PASS
- **Evidence**: Graph.Indexer.Tests 37/37 pass (clustering/centrality tests covered). All source files verified (10/10).
### Tier 2 Recheck (Behavioral Integration)
- **Run ID**: run-002
- **Date**: 2026-02-10T11:41:00Z
- **Tier**: 2 (Behavioral integration verification)
- **Result**: PASS
- **Evidence**: Revalidated clustering/centrality behavior through indexer analytics suite execution (`Graph.Indexer.Tests` 37/37). Artifact: `docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-002/tier2-integration-check.json`.
## Recheck (Run-005)
- **Verified**: 2026-02-10
- **Method**: Tier 2d deterministic integration replay.
- **Tests**: PASS (`src/Graph/__Tests/StellaOps.Graph.Indexer.Tests`: 37/37).
- **Tier 2 Evidence**: `docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-005/tier2-integration-check.json`
- **Outcome**: Clustering and centrality background job behavior remains healthy.
## Recheck (Run-006)
- **Verified**: 2026-02-10
- **Method**: Tier 2 replay validated via Graph API/indexer suites.
- **Tests**: PASS (src/Graph/__Tests/StellaOps.Graph.Api.Tests: 66/66; src/Graph/__Tests/StellaOps.Graph.Indexer.Tests: 37/37; src/Graph/__Tests/StellaOps.Graph.Indexer.Persistence.Tests: 17/17).
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-006/tier2-integration-check.json
- **Outcome**: Clustering and centrality background-job behavior remains healthy.
## Recheck (Run-007)
- **Verified**: 2026-02-10
- **Method**: Tier 2 replay validated via Graph API/indexer suites.
- **Tests**: PASS (src/Graph/__Tests/StellaOps.Graph.Api.Tests: 66/66; src/Graph/__Tests/StellaOps.Graph.Indexer.Tests: 37/37; src/Graph/__Tests/StellaOps.Graph.Indexer.Persistence.Tests: 17/17).
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-007/tier2-integration-check.json
- **Outcome**: Clustering and centrality background-job behavior remains healthy.
## Recheck (Run-008)
- **Verified**: 2026-02-10
- **Method**: Tier 2 replay validated via Graph API/indexer suites.
- **Tests**: PASS (src/Graph/__Tests/StellaOps.Graph.Api.Tests: 66/66; src/Graph/__Tests/StellaOps.Graph.Indexer.Tests: 37/37; src/Graph/__Tests/StellaOps.Graph.Indexer.Persistence.Tests: 17/17).
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-008/tier2-integration-check.json
- **Outcome**: Clustering and centrality background-job behavior remains healthy.
## Recheck (Run-009)
- **Verified**: 2026-02-10
- **Method**: Tier 2d deterministic integration replay.
- **Tests**: PASS (Graph.Api.Tests 66/66, Graph.Indexer.Tests 37/37, Graph.Indexer.Persistence.Tests 17/17).
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-009/tier2-integration-check.json
- **Outcome**: Checked Graph behavior remains healthy in continued replay.
## Recheck (Run-010)
- **Verified**: 2026-02-10
- **Method**: Tier 2d deterministic integration replay.
- **Tests**: PASS (Graph Api 66/66, Indexer 37/37, Indexer.Persistence 17/17; total 120/120).
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-010/tier2-integration-check.json
- **Outcome**: Checked graph behavior remains healthy in continued replay.
## Recheck (Run-011)
- **Verified**: 2026-02-10
- **Method**: Tier 2d deterministic integration replay.
- **Tests**: PASS (Graph Api 66/66, Indexer 37/37, Indexer.Persistence 17/17; total 120/120).
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-011/tier2-integration-check.json
- **Outcome**: Checked graph behavior remains healthy in continued replay.
## Recheck (Run-012)
- **Verified**: 2026-02-10
- **Method**: Tier 2 replay + deterministic Graph suite replay.
- **Tests**: PASS (Graph.Api 66/66, Graph.Indexer 37/37, Graph.Indexer.Persistence 17/17; total 120/120).
- **Tier 2 Evidence**: docs/qa/feature-checks/runs/graph/graph-indexer-clustering-and-centrality-background-jobs/run-012/tier2-integration-check.json
- **Outcome**: Checked graph behavior remains healthy in continued replay.