-
Notifications
You must be signed in to change notification settings - Fork 0
Phase 3: Structural Validation, Health Assessment, Telemetry & Performance Guardrails #2948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
9948bd0
016bf9f
28a82f4
5d44e55
adc8b14
57c7e4c
2e21dc2
2cf122b
403bec5
94b256d
26d119a
92edee0
ff540b4
a0940fe
7ee5e1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| ## [9.1.0] - 2025-11-14 | ||
|
|
||
| ### Added | ||
|
|
||
| - Phase 3 structural instrumentation: | ||
| - `run_structural_validation` aggregator (grammar U1-U3 + field thresholds Φ_s, |∇φ|, K_φ, ξ_C, optional ΔΦ_s drift). | ||
| - `compute_structural_health` with risk levels and recommendations. | ||
| - `TelemetryEmitter` integration example (`examples/structural_health_demo.py`). | ||
| - Performance guardrails: `PerformanceRegistry`, `perf_guard`, `compare_overhead`. | ||
| - CLI: `scripts/structural_health_report.py` (on-demand health summaries). | ||
| - Docs: README Phase 3 section, CONTRIBUTING instrumentation notes, `docs/STRUCTURAL_HEALTH.md`. | ||
| - Glyph-aware grammar error factory (operator glyph → canonical name mapping). | ||
|
|
||
| ### Tests | ||
|
|
||
| - Added unit tests for validation, health, grammar error factory, telemetry emitter, performance guardrails. | ||
|
|
||
| ### Performance | ||
|
|
||
| - Validation instrumentation overhead ~5.8% (moderate workload) below 8% guardrail. | ||
|
|
||
| ### Internal | ||
|
|
||
| - Optional `perf_registry` parameter in `run_structural_validation` (read-only timing). | ||
|
|
||
| ### Deferred | ||
|
|
||
| - U4 bifurcation validation excluded pending dedicated handler reintroduction. | ||
|
|
||
| ### Integrity | ||
|
|
||
| - All changes preserve TNFR canonical invariants (no EPI mutation; phase verification intact; read-only telemetry/validation). | ||
|
|
||
| ## [9.0.2] | ||
|
|
||
| Previous release (see repository history) with foundational operators, unified grammar, metrics, and canonical field tetrad. | ||
|
|
||
| --- | ||
| **Reality is not made of things—it's made of resonance.** |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -71,6 +71,57 @@ Comprehensive observability: | |||||
| - **νf**: Structural frequency (Hz_str) | ||||||
| - **φ**: Phase synchrony [0, 2π] | ||||||
|
|
||||||
| ### 🧪 Phase 3 Structural Instrumentation | ||||||
|
|
||||||
| Unified observability and safety layers (read-only): | ||||||
|
|
||||||
| - `run_structural_validation` combines grammar (U1-U4) + field thresholds. | ||||||
| - `compute_structural_health` converts validation output to recommendations. | ||||||
| - `TelemetryEmitter` streams coherence, sense index, Φ_s, |∇φ|, K_φ, ξ_C. | ||||||
| - `PerformanceRegistry` + `perf_guard` measure overhead (< ~8% in tests). | ||||||
|
|
||||||
| Usage: | ||||||
|
|
||||||
| ```python | ||||||
| from tnfr.validation.aggregator import run_structural_validation | ||||||
| from tnfr.validation.health import compute_structural_health | ||||||
| from tnfr.performance.guardrails import PerformanceRegistry | ||||||
|
|
||||||
| perf = PerformanceRegistry() | ||||||
| report = run_structural_validation( | ||||||
| G, | ||||||
| sequence=["AL","UM","IL","SHA"], | ||||||
| perf_registry=perf, | ||||||
| ) | ||||||
| health = compute_structural_health(report) | ||||||
| print(report.risk_level, health.recommendations) | ||||||
|
||||||
| print(report.risk_level, health.recommendations) | |
| print(report.risk_level, health["recommended_actions"]) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,112 @@ | ||||||||||||||||||||||
| # Structural Health & Validation (Phase 3) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Unified structural validation and health assessment introduced in Phase 3 | ||||||||||||||||||||||
| provide a physics-aligned safety layer over TNFR networks without mutating | ||||||||||||||||||||||
| state. All computations are read-only and trace back to canonical fields and | ||||||||||||||||||||||
| grammar. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Components | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - **Validation Aggregator**: `run_structural_validation` combines: | ||||||||||||||||||||||
| - Grammar (U1 Initiation/Closure, U2 Convergence, U3 Resonant Coupling, | ||||||||||||||||||||||
| U4 triggers deferred) via `collect_grammar_errors`. | ||||||||||||||||||||||
| - Canonical fields: Φ_s, |∇φ|, K_φ, ξ_C. | ||||||||||||||||||||||
| - Optional drift (ΔΦ_s) if baseline provided. | ||||||||||||||||||||||
| - **Health Summary**: `compute_structural_health(report)` derives: | ||||||||||||||||||||||
| - `risk_level` (low, elevated, critical) | ||||||||||||||||||||||
| - Actionable recommendations (stabilize, reduce gradient, monitor ξ_C, etc.) | ||||||||||||||||||||||
| - **Telemetry**: `TelemetryEmitter` emits metrics + fields for longitudinal | ||||||||||||||||||||||
| analysis. | ||||||||||||||||||||||
| - **Performance Guardrails**: `PerformanceRegistry` + `perf_guard` measure | ||||||||||||||||||||||
| overhead (< ~8% under moderate workload tests). | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Thresholds (Defaults) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| | Quantity | Default | Meaning | | ||||||||||||||||||||||
| |---------------------|---------|--------------------------------------------------| | ||||||||||||||||||||||
| | ΔΦ_s | 2.0 | Escape threshold (confinement breach) | | ||||||||||||||||||||||
| | max(|∇φ|) | 0.38 | Local stress / desynchronization warning | | ||||||||||||||||||||||
| | max(|K_φ|) | 3.0 | Curvature fault pocket (mutation risk locus) | | ||||||||||||||||||||||
| | ξ_C critical | > diameter * 1.0 | Approaching global correlation divergence | | ||||||||||||||||||||||
| | ξ_C watch | > mean_distance * 3.0 | Extended local correlation zone | | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| All thresholds empirically validated (see `AGENTS.md`). Override values via | ||||||||||||||||||||||
| function parameters to adapt for specialized topologies or experiments. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Risk Levels | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - **low**: Grammar valid, no thresholds exceeded. | ||||||||||||||||||||||
| - **elevated**: Local stress (phase gradient spike, curvature pocket, coherence | ||||||||||||||||||||||
| length watch condition). | ||||||||||||||||||||||
| - **critical**: Grammar invalid OR confinement/critical ξ_C breach OR ΔΦ_s drift | ||||||||||||||||||||||
| beyond escape. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Example | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```python | ||||||||||||||||||||||
| from tnfr.validation.aggregator import run_structural_validation | ||||||||||||||||||||||
| from tnfr.validation.health import compute_structural_health | ||||||||||||||||||||||
| from tnfr.performance.guardrails import PerformanceRegistry | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| perf = PerformanceRegistry() | ||||||||||||||||||||||
| report = run_structural_validation( | ||||||||||||||||||||||
| G, | ||||||||||||||||||||||
| sequence=["AL","UM","IL","SHA"], | ||||||||||||||||||||||
| perf_registry=perf, | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
| health = compute_structural_health(report) | ||||||||||||||||||||||
| print(report.risk_level, report.thresholds_exceeded) | ||||||||||||||||||||||
| for rec in health.recommendations: | ||||||||||||||||||||||
|
Comment on lines
+57
to
+59
|
||||||||||||||||||||||
| health = compute_structural_health(report) | |
| print(report.risk_level, report.thresholds_exceeded) | |
| for rec in health.recommendations: | |
| health = compute_structural_health( | |
| G, | |
| sequence=["AL","UM","IL","SHA"], | |
| perf_registry=perf, | |
| ) | |
| print(health["risk_level"], health["thresholds_exceeded"]) | |
| for rec in health["recommended_actions"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example calls
compute_structural_health(report)but this function expects a graphGas its first parameter, not aValidationReport.Based on the function signature, the correct usage is:
This is a separate call from
run_structural_validation.