Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Drift Detection Architecture

Overview

Drift detection is pact’s core mechanism for tracking configuration state divergence. It follows a blacklist-first approach (ADR-002): observe everything, exclude known noise.

Drift Vector

Seven dimensions tracked independently:

DimensionSourceWeightExample
kernelsysctl changes2.0vm.swappiness modified
mountsmount/unmount events1.0NFS share mounted
filesfile create/modify/delete1.0/etc/ntp.conf changed
networkinterface changes1.0eth0 link state change
servicesprocess start/stop1.0nginx started
packagespackage install/remove1.0CUDA toolkit updated
gpuGPU state changes2.0GPU health degraded

Magnitude: Weighted L2 norm of the drift vector. Kernel and GPU have 2x weight (higher impact on node behavior).

Observer Pipeline

Observer → ObserverEvent → DriftEvaluator → CommitWindowManager
   │                            │                    │
   ├─ InotifyObserver (files)   ├─ blacklist filter   ├─ window = base / (1 + mag * sens)
   ├─ NetlinkObserver (network) ├─ category mapping   ├─ Idle → Open → Expired
   └─ EbpfObserver (kernel)     └─ magnitude calc     └─ emergency extends window

Blacklist Patterns

Default patterns (noise suppression):

/tmp/**
/var/log/**
/proc/**
/sys/**
/dev/**
/run/user/**

Pattern matching:

  • ** = recursive match (any depth)
  • /* = single path segment
  • Exact paths = literal match

Blacklist is dynamically updateable via config subscription from journal.

Commit Window

Formula: window_seconds = base_window / (1 + drift_magnitude * sensitivity)

DriftSensitivity=2.0Base=900sWindow
0.0-900sIdle (no window)
0.52.0900s450s
1.02.0900s300s
5.02.0900s82s

Minimum window: 60 seconds (clamped). Emergency mode: window extended to emergency_window_seconds (default 4 hours).

Conflict Resolution (CR1-CR3)

On partition reconnect:

  1. Agent compares local state against journal entries
  2. Conflicting keys are registered in ConflictManager
  3. Grace period: admin resolves per-key (AcceptLocal | AcceptJournal)
  4. Auto-resolve: journal-wins after grace period expires
  5. All resolutions logged for audit

Homogeneity Check (ND3)

vCluster nodes should have identical config. Per-node deltas (node-scoped entries) indicate heterogeneity. check_homogeneity() reports nodes with per-node deltas that diverge from the vCluster overlay.