Compare commits
2 Commits
sprint/iss
...
fix/749
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
909b88af56 | ||
|
|
f9f342cee7 |
@@ -12,8 +12,8 @@ The predictor reads two data sources:
|
||||
2. **Heartbeat logs** (`heartbeat/ticks_*.jsonl`) — Gitea availability,
|
||||
local inference health
|
||||
|
||||
It compares a **recent window** (last N hours) against a **baseline window**
|
||||
(previous N hours) to detect surges and degradation.
|
||||
It compares a **recent window** (last N hours of activity) against the **previous active window**
|
||||
(previous N hours ending at the most recent event before the current window) so sparse telemetry still yields a meaningful baseline.
|
||||
|
||||
## Output Contract
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
# Issue #582 — Epic Slice Verification
|
||||
|
||||
Refs #582
|
||||
|
||||
## Status: COMPLETE ON MAIN
|
||||
|
||||
The parent-epic orchestration slice for the Know Thy Father multimodal pipeline is already merged and functional on `main`.
|
||||
|
||||
## Mainline Evidence
|
||||
|
||||
### Core implementation files
|
||||
- `scripts/know_thy_father/epic_pipeline.py` — orchestrator that chains all phases
|
||||
- `docs/KNOW_THY_FATHER_MULTIMODAL_PIPELINE.md` — pipeline documentation
|
||||
- `tests/test_know_thy_father_pipeline.py` — orchestrator tests
|
||||
|
||||
### Phase implementation (all on main)
|
||||
| Phase | Description | Script |
|
||||
|-------|-------------|--------|
|
||||
| phase1_media_indexing | Scan archive for media | `scripts/know_thy_father/index_media.py` |
|
||||
| phase2_multimodal_analysis | Process media entries | `scripts/twitter_archive/analyze_media.py` |
|
||||
| phase3_holographic_synthesis | Kernel synthesis | `scripts/know_thy_father/synthesize_kernels.py` |
|
||||
| phase4_cross_reference_audit | Cross-ref audit | `scripts/know_thy_father/crossref_audit.py` |
|
||||
|
||||
### Merged PRs (chronological)
|
||||
- PR #630 — Phase 1: Media indexing
|
||||
- PR #631 — Phase 2: Multimodal analysis
|
||||
- PR #637 — Phase 3: Holographic synthesis
|
||||
- PR #639 — Phase 4: Cross-reference audit
|
||||
- PR #641 — Orchestrator pipeline integration
|
||||
- PR #738 — Prior parent-epic slice (closed)
|
||||
|
||||
### Test coverage
|
||||
- `tests/test_know_thy_father_pipeline.py` — orchestrator
|
||||
- `tests/test_know_thy_father_index.py` — phase 1
|
||||
- `tests/test_know_thy_father_synthesis.py` — phase 3
|
||||
- `tests/test_know_thy_father_crossref.py` — phase 4
|
||||
- `tests/twitter_archive/test_ktf_tracker.py` — tracker
|
||||
- `tests/twitter_archive/test_analyze_media.py` — phase 2
|
||||
|
||||
## Why Refs, Not Closes
|
||||
|
||||
The repo-side parent-epic operational slice is fully implemented on `main`. However, the epic (#582) itself remains open because:
|
||||
|
||||
1. Full archive consumption is not yet complete
|
||||
2. Downstream memory integration is pending
|
||||
3. The orchestrator is functional but not yet exercised against the complete archive
|
||||
|
||||
This verification document provides the proof trail that the orchestrator slice is done, preventing duplicate reimplementation.
|
||||
|
||||
## Verification Commands
|
||||
|
||||
```bash
|
||||
# Verify this issue's test
|
||||
python3 -m pytest tests/test_issue_582_verification.py -q
|
||||
|
||||
# Verify all Know Thy Father tests pass
|
||||
python3 -m pytest tests/test_know_thy_father_pipeline.py tests/test_know_thy_father_index.py tests/test_know_thy_father_synthesis.py tests/test_know_thy_father_crossref.py tests/twitter_archive/test_ktf_tracker.py tests/twitter_archive/test_analyze_media.py -q
|
||||
```
|
||||
@@ -90,13 +90,19 @@ def compute_rates(
|
||||
|
||||
latest = max(_parse_ts(r["timestamp"]) for r in rows)
|
||||
recent_cutoff = latest - timedelta(hours=horizon_hours)
|
||||
baseline_cutoff = latest - timedelta(hours=horizon_hours * 2)
|
||||
|
||||
recent = [r for r in rows if _parse_ts(r["timestamp"]) >= recent_cutoff]
|
||||
baseline = [
|
||||
r for r in rows
|
||||
if baseline_cutoff <= _parse_ts(r["timestamp"]) < recent_cutoff
|
||||
]
|
||||
|
||||
earlier = [r for r in rows if _parse_ts(r["timestamp"]) < recent_cutoff]
|
||||
if earlier:
|
||||
previous_latest = max(_parse_ts(r["timestamp"]) for r in earlier)
|
||||
previous_cutoff = previous_latest - timedelta(hours=horizon_hours)
|
||||
baseline = [
|
||||
r for r in earlier
|
||||
if _parse_ts(r["timestamp"]) >= previous_cutoff
|
||||
]
|
||||
else:
|
||||
baseline = []
|
||||
|
||||
recent_rate = len(recent) / max(horizon_hours, 1)
|
||||
baseline_rate = (
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
"""Verification that the Issue #582 epic orchestration slice exists on main.
|
||||
|
||||
Refs #582 — this test provides durable evidence that the parent-epic
|
||||
orchestrator and all phase scripts are present and importable.
|
||||
"""
|
||||
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
class TestIssue582Verification(unittest.TestCase):
|
||||
"""Confirm the Know Thy Father epic slice is on main."""
|
||||
|
||||
def _load_module(self, path: Path, name: str):
|
||||
self.assertTrue(path.exists(), f"missing {path.relative_to(ROOT)}")
|
||||
spec = importlib.util.spec_from_file_location(name, path)
|
||||
self.assertIsNotNone(spec)
|
||||
self.assertIsNotNone(spec.loader)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
# --- core orchestrator ---
|
||||
|
||||
def test_epic_pipeline_exists(self):
|
||||
path = ROOT / "scripts" / "know_thy_father" / "epic_pipeline.py"
|
||||
self.assertTrue(path.exists(), "epic_pipeline.py must exist on main")
|
||||
|
||||
def test_epic_pipeline_has_phases(self):
|
||||
mod = self._load_module(
|
||||
ROOT / "scripts" / "know_thy_father" / "epic_pipeline.py",
|
||||
"ktf_epic_pipeline",
|
||||
)
|
||||
self.assertTrue(hasattr(mod, "PHASES"), "PHASES list must be defined")
|
||||
self.assertGreaterEqual(len(mod.PHASES), 4, "at least 4 phases required")
|
||||
|
||||
# --- phase scripts ---
|
||||
|
||||
def test_phase1_media_indexing_exists(self):
|
||||
self.assertTrue(
|
||||
(ROOT / "scripts" / "know_thy_father" / "index_media.py").exists(),
|
||||
"phase1 script index_media.py must exist",
|
||||
)
|
||||
|
||||
def test_phase2_analyze_media_exists(self):
|
||||
self.assertTrue(
|
||||
(ROOT / "scripts" / "twitter_archive" / "analyze_media.py").exists(),
|
||||
"phase2 script analyze_media.py must exist",
|
||||
)
|
||||
|
||||
def test_phase3_synthesize_kernels_exists(self):
|
||||
self.assertTrue(
|
||||
(ROOT / "scripts" / "know_thy_father" / "synthesize_kernels.py").exists(),
|
||||
"phase3 script synthesize_kernels.py must exist",
|
||||
)
|
||||
|
||||
def test_phase4_crossref_audit_exists(self):
|
||||
self.assertTrue(
|
||||
(ROOT / "scripts" / "know_thy_father" / "crossref_audit.py").exists(),
|
||||
"phase4 script crossref_audit.py must exist",
|
||||
)
|
||||
|
||||
# --- documentation ---
|
||||
|
||||
def test_pipeline_docs_exist(self):
|
||||
self.assertTrue(
|
||||
(ROOT / "docs" / "KNOW_THY_FATHER_MULTIMODAL_PIPELINE.md").exists(),
|
||||
"pipeline documentation must exist",
|
||||
)
|
||||
|
||||
def test_verification_doc_exists(self):
|
||||
self.assertTrue(
|
||||
(ROOT / "docs" / "issue-582-verification.md").exists(),
|
||||
"issue-582-verification.md must exist",
|
||||
)
|
||||
|
||||
# --- test coverage ---
|
||||
|
||||
def test_pipeline_tests_exist(self):
|
||||
tests = [
|
||||
"test_know_thy_father_pipeline.py",
|
||||
"test_know_thy_father_index.py",
|
||||
"test_know_thy_father_synthesis.py",
|
||||
"test_know_thy_father_crossref.py",
|
||||
]
|
||||
for name in tests:
|
||||
self.assertTrue(
|
||||
(ROOT / "tests" / name).exists(),
|
||||
f"test file {name} must exist",
|
||||
)
|
||||
|
||||
def test_archive_tests_exist(self):
|
||||
archive_dir = ROOT / "tests" / "twitter_archive"
|
||||
self.assertTrue(
|
||||
(archive_dir / "test_ktf_tracker.py").exists(),
|
||||
"test_ktf_tracker.py must exist",
|
||||
)
|
||||
self.assertTrue(
|
||||
(archive_dir / "test_analyze_media.py").exists(),
|
||||
"test_analyze_media.py must exist",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -99,6 +99,17 @@ class TestComputeRates:
|
||||
_, _, surge, _, _ = compute_rates(rows, horizon_hours=6)
|
||||
assert surge < 1.5
|
||||
|
||||
def test_falls_back_to_prior_activity_when_previous_window_is_empty(self):
|
||||
baseline = _make_metrics(3, base_hour=0)
|
||||
recent = _make_metrics(6, base_hour=12)
|
||||
rows = baseline + recent
|
||||
|
||||
recent_rate, baseline_rate, surge, _, _ = compute_rates(rows, horizon_hours=6)
|
||||
|
||||
assert recent_rate == 1.0
|
||||
assert baseline_rate == 0.5
|
||||
assert surge == 2.0
|
||||
|
||||
|
||||
# ── Caller Analysis ──────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user