Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/wiki/02-22-state-rehydrator.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# The State Rehydrator (Memory Cryolinks)
# The State Rehydrator (RAM Rehydration)

> **The Fast-Track for CI/CD**
>
> The State Rehydrator (`state_rehydrator.py`) is the engine that enables GitGalaxy to run efficiently in Continuous Integration/Continuous Deployment (CI/CD) pipelines.
>
> Scanning a massive 10,000-file repository from scratch takes compute time. However, in a standard CI pipeline, a developer might only modify three files in a single commit. The State Rehydrator bridges this gap by querying the SQLite Record Keeper and instantly "thawing" the repository's previous historical state directly back into live Python RAM.

## The Cryo-Chamber (SQLite to RAM)
## State Extraction (SQLite to RAM)

When a Delta Mission is initiated, the Rehydrator bypasses the Optical Pipeline entirely and interfaces directly with the `_galaxy_graph.sqlite` database.

* **Commit Targeting:** The engine queries the `repo_data` table to find the absolute most recent `commit_hash` that GitGalaxy successfully scanned for the target repository.
* **State Reconstruction:** It extracts the physical metrics of every file (e.g., `file_impact`, `total_loc`, `control_flow_ratio`, `ai_threat_score`) from the `file_data` table.
* **The Cryolink Payload:** It maps these static database rows back into a live Python dictionary schema (the `cryolink`), perfectly mimicking the RAM state that the Orchestrator would have generated during a full scan.
* **State Reconstruction:** It extracts the structural metrics of every file (e.g., `file_impact`, `total_loc`, `control_flow_ratio`, `ai_threat_score`) from the `file_data` table.
* **The State Payload:** It maps these static database rows back into a live Python dictionary schema (the `ram_cache`), perfectly mimicking the RAM state that the Orchestrator would have generated during a full scan.

## Temporal Diffs and Delta Scans

Expand All @@ -21,14 +21,14 @@ This rehydration process is the strict mechanical foundation that makes temporal
Instead of re-running regex math on the entire universe, GitGalaxy leverages the rehydrated state to execute a **Delta Mission**:

1. **Surgical Extraction:** The pipeline asks Git which specific files were modified or added in the new commit. It runs the heavy optical scanners (Language Lens, Security Lens) *only* on those isolated files.
2. **State Merging:** The newly calculated file states overwrite their older counterparts inside the rehydrated `cryolink` RAM dictionary.
3. **The Ripple Effect:** With the merged state living in RAM, the Orchestrator instantly triggers the downstream physics engines (Network Graph, XGBoost Security Auditor). Because network topology (Blast Radius, PageRank) is globally interconnected, modifying even one file can shift the gravity of the entire system.
2. **State Merging:** The newly calculated file states overwrite their older counterparts inside the rehydrated `ram_cache` dictionary.
3. **Dependency Graph Recalculation:** With the merged state living in RAM, the Orchestrator instantly triggers the downstream analysis engines (Network Graph, XGBoost Security Auditor). Because network topology (Blast Radius, PageRank) is globally interconnected, modifying even one file can shift the gravity of the entire system.

## Structural Delta Reporting

By having immediate access to both the "Old State" (via SQLite) and the "New State" (via the Delta Mission), GitGalaxy can instantly calculate exact structural diffs.

Instead of a standard Git diff showing *text* changes, the engine outputs **Physics Deltas**:
Instead of a standard Git diff showing *text* changes, the engine outputs **Structural Deltas**:
* *"This commit increased the system's Tech Debt by 14%."*
* *"This commit shifted the Blast Radius of `auth.py`, making it a system bottleneck."*
* *"This commit introduced a new Agentic RCE vulnerability."*
Expand All @@ -50,4 +50,4 @@ This documentation is part of the [GitGalaxy Ecosystem](https://github.com/squid

---

**[⬅️ Back to Master Index](index.md)**
**[⬅️ Back to Master Index](index.md)**
268 changes: 109 additions & 159 deletions gitgalaxy/core/aperture.py

Large diffs are not rendered by default.

Loading
Loading