Skip to content

Spandan228/LineageKnot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LineageKnot: Self-Healing Dependency Graph Sentinel

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.


Repository Structure

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

Architectural Features

  1. 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.
  2. Transaction-Safe (TOCTOU Proof): The scanning, anomaly isolation, and updating occur inside a single stored procedure (silver.sp_self_heal_dependencies) under a SERIALIZABLE transaction isolation level. This locks the topology table, preventing race conditions or concurrency conflicts.
  3. Structure Preservation & Auditing: Instead of deleting connections or setting them to NULL, loops are broken by setting the link status to DEGRADED_HEALED. The view automatically filters out degraded paths, resolving the cycle while preserving structural history in the database.
  4. 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.

Setup & Prerequisites

Prerequisites

  • 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)

Environment Configuration

  1. Copy the template configuration file:
    cp .env.example .env
  2. Open .env and set your SQL Server system administrator (sa) password:
    MSSQL_SA_PASSWORD=YourSecure_Password123!

Getting Started

To execute the entire end-to-end pipeline, run the master runner script:

powershell -File run_sentinel.ps1

Execution Telemetry Output Example

==========================================================================
             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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Active infrastructure dependency tracker and self-healing graph engine to detect and repair lineage loop anomalies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors