feat(application): integrate measured-load ingestion training and planner source

This commit is contained in:
ENELIX Agent
2026-10-02 21:00:05 +00:00
parent 44362e4bf5
commit fc024fcfba
96 changed files with 8933 additions and 0 deletions
@@ -0,0 +1,36 @@
"""Offline candidate-forecast tests: no telemetry, model loading or publication.
Run in an unprivileged, networkless test container with no live data volumes.
"""
from pathlib import Path
import ast
import hashlib
import json
import sys
import unittest
def main():
root = Path('/app/forecast')
sys.path.insert(0, str(root))
manifest = json.loads((root / 'SOURCE_MANIFEST.json').read_text())
for relative, expected in manifest.items():
p = root / relative
if Path(relative).is_absolute() or '..' in Path(relative).parts or not p.resolve().is_relative_to(root):
raise ValueError('Unsafe manifest path')
raw = p.read_bytes()
if hashlib.sha256(raw).hexdigest() != expected:
raise ValueError('Test image source checksum mismatch')
if p.suffix == '.py':
ast.parse(raw, filename=str(p))
import pandas, numpy, scipy, sklearn
versions = {'python': sys.version.split()[0], 'pandas': pandas.__version__,
'numpy': numpy.__version__, 'scipy': scipy.__version__, 'sklearn': sklearn.__version__}
print('Candidate forecast runtime:', json.dumps(versions), flush=True)
suite = unittest.defaultTestLoader.discover(str(root / 'tests'))
result = unittest.TextTestRunner(verbosity=2).run(suite)
print('Forecast tests only; no live data, no publication, no training job.', flush=True)
return 0 if result.wasSuccessful() else 1
if __name__ == '__main__':
raise SystemExit(main())