LineageKnot is an active infrastructure dependency sentinel that translates relational table schemas into a self-healing graph engine. It traces microservice lineages, detects circular cyclical dependencies, and dynamically repairs loop anomalies under strict transactional isolation.
The project has been organized according to professional data-engineering repository standards:
lineage-knot/
├── .env.example # Template for database configuration parameters
├── .gitignore # Git tracking exclusion list
├── LICENSE # MIT License
├── README.md # Project documentation
├── run_sentinel.ps1 # Master automation runner (PowerShell Core)
└── sql/
├── schema/
│ └── 01_system_dependencies.sql # Database structures and audit logging tables
├── seeds/
│ └── 01_seed_dependencies.sql # Mock dependency topology seeds (8 microservices)
└── procedures/
└── 01_sentinel_views_procs.sql # Recursive CTE Graph View and Self-Healing Stored Proc
- Cycle Detection (Recursive CTE):
Discovers downstream systems starting from terminal root endpoints (
target_node IS NULL) utilizing a recursive Common Table Expression (CTE). It detects cycles in real-time, measuring path depth, and flags loops instantly if a node is visited twice in a lineage path. - Transaction-Safe (TOCTOU Proof):
The scanning, anomaly isolation, and updating occur inside a single stored procedure (
silver.sp_self_heal_dependencies) under aSERIALIZABLEtransaction isolation level. This locks the topology table, preventing race conditions or concurrency conflicts. - Structure Preservation & Auditing:
Instead of deleting connections or setting them to
NULL, loops are broken by setting the link status toDEGRADED_HEALED. The view automatically filters out degraded paths, resolving the cycle while preserving structural history in the database. - Automated Audit Logs:
Every healing event logs the corrupted node, broken upstream target, timestamp, and a SHA-256 confirmation code in
silver.dependency_healing_log.
- Microsoft SQL Server 2022 (Running locally or in a Docker container)
- PowerShell Core (7.x recommended or Windows PowerShell 5.1+)
- Docker Desktop (if deploying SQL Server via containerization)
- Copy the template configuration file:
cp .env.example .env
- Open
.envand set your SQL Server system administrator (sa) password:MSSQL_SA_PASSWORD=YourSecure_Password123!
To execute the entire end-to-end pipeline, run the master runner script:
powershell -File run_sentinel.ps1==========================================================================
LINEAGEKNOT: AUTONOMOUS SELF-HEALING ENGINE
==========================================================================
[1/4] Generating Database Structures (DDL)...
STATUS: Schema and log tables created.
[2/4] Ingesting Seed Data Package (DML)...
STATUS: Ingested 8 dependency records.
[3/4] Compiling Sentinel View & Stored Procedure...
STATUS: Views and stored procedures compiled.
[4/4] Starting Graph Scan & Autonomous Stored Proc Execution...
ANOMALY DETECTED!
Loop Lineage Trace : PortalService -> ServiceA -> ServiceC -> ServiceB -> ServiceA
Isolated Malicious Node: ServiceA (closes loop back to ServiceB)
STATUS: Autonomous self-healing transaction completed successfully.
Confirmation Code: CONFIRMATION_CODE_SHA256_BE1C522E0C4EBCD016322E661E2C346A3354EBA5599321777B00E3DA0D3B822A
Re-scanning graph post-heal to verify loop resolution...
STATUS: Graph is healthy. 0 loops remaining.
This project is licensed under the MIT License - see the LICENSE file for details.