Compare commits

..

2 Commits

Author SHA1 Message Date
Alexander Whitestone
909b88af56 fix: use prior active window baseline for #749
Some checks failed
Agent PR Gate / gate (pull_request) Failing after 12s
Self-Healing Smoke / self-healing-smoke (pull_request) Failing after 5s
Smoke Test / smoke (pull_request) Failing after 5s
Agent PR Gate / report (pull_request) Has been cancelled
2026-04-17 00:19:50 -04:00
Alexander Whitestone
f9f342cee7 test: capture sparse baseline fallback for #749 2026-04-17 00:17:21 -04:00
5 changed files with 32 additions and 102 deletions

View File

@@ -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

View File

@@ -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 = (

View File

@@ -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 ──────────────────────────────────────────────────────────

View File

@@ -1,15 +1,15 @@
from pathlib import Path
GENOME = Path('timmy-config-GENOME.md')
GENOME = Path('GENOME.md')
def read_genome() -> str:
assert GENOME.exists(), 'timmy-config-GENOME.md must exist at repo root'
assert GENOME.exists(), 'GENOME.md must exist at repo root'
return GENOME.read_text(encoding='utf-8')
def test_genome_exists():
assert GENOME.exists(), 'timmy-config-GENOME.md must exist at repo root'
assert GENOME.exists(), 'GENOME.md must exist at repo root'
def test_genome_has_required_sections():
@@ -17,7 +17,7 @@ def test_genome_has_required_sections():
for heading in [
'# GENOME.md — timmy-config',
'## Project Overview',
'## Architecture',
'## Architecture Diagram',
'## Entry Points and Data Flow',
'## Key Abstractions',
'## API Surface',
@@ -42,6 +42,9 @@ def test_genome_mentions_core_timmy_config_files():
'gitea_client.py',
'orchestration.py',
'tasks.py',
'bin/',
'playbooks/',
'training/',
]:
assert token in text
@@ -55,9 +58,4 @@ def test_genome_explains_sidecar_boundary():
def test_genome_is_substantial():
text = read_genome()
assert len(text) >= 2000
def test_genome_references_upstream_issue():
text = read_genome()
assert 'timmy-config #823' in text or '#823' in text
assert len(text) >= 5000

View File

@@ -1,85 +0,0 @@
# GENOME.md — timmy-config
Generated: 2026-04-18 15:00:00 EDT
Analyzed repo: Timmy_Foundation/timmy-config
Analyzed commit: 04ecad3
Host issue: timmy-home #814
Upstream issue: timmy-config #823
## Project Overview
`timmy-config` is a sidecar overlay repository for the Timmy ecosystem. It is **not** a Hermes-agent fork. It provides configuration, deployment automation, and orchestration tooling that wraps around the core Timmy services.
The repo ships its own `GENOME.md` on `main`, making this host-repo artifact a cross-repo genome lane entry that documents `timmy-config`'s role relative to `timmy-home` and the broader fleet.
Current target-repo test health: `python3 -m pytest -q` stops at **7 collection errors** on `main`. This is documented and tracked in upstream issue timmy-config #823.
## Architecture
```mermaid
graph TD
DEPLOY[deploy.sh] --> PLAY[playbooks/]
DEPLOY --> BIN[bin/]
CONFIG[config.yaml] --> ORCH[orchestration.py]
CONFIG --> GITEA[gitea_client.py]
ORCH --> TASKS[tasks.py]
GITEA --> API[Gitea API]
TASKS --> TRAINING[training/]
DOCS[README.md] --> BOUNDARY{timmy-config vs timmy-home\narchitectural boundary}
BOUNDARY --> SIDECAR[Sidecar overlay pattern]
SIDECAR --> HERMES[Hermes ecosystem integration]
```
## Entry Points and Data Flow
### `deploy.sh`
Primary deployment entry point. Orchestrates the rollout of configuration and sidecar services.
### `config.yaml`
Central configuration surface. Feeds into orchestration and task scheduling.
### `gitea_client.py`
Gitea API client. Handles communication with the Forge for issue and PR operations.
### `orchestration.py`
Orchestration engine. Coordinates task execution and deployment workflows.
### `tasks.py`
Task definitions. Contains the concrete work units dispatched by the orchestrator.
## Key Abstractions
- **Sidecar overlay**: `timmy-config` layers on top of core Timmy services without forking the Hermes-agent pattern
- **Control-plane surfaces**: `deploy.sh`, `config.yaml`, `gitea_client.py`, `orchestration.py`, `tasks.py` form the clearest control-plane surfaces
- **Architectural boundary**: The README boundary between `timmy-config` and `timmy-home` is architecturally important
## API Surface
- Gitea client API via `gitea_client.py`
- Task scheduling via `tasks.py`
- Deployment automation via `deploy.sh` and playbooks
## Test Coverage Gaps
- **7 collection errors** on `main` prevent pytest from running any tests
- Upstream issue timmy-config #823 filed to track broken pytest collection
- `bin/`, `playbooks/`, and `training/` directories referenced but test coverage status unknown
## Security Considerations
- `config.yaml` likely contains deployment credentials and service endpoints
- `gitea_client.py` handles API authentication tokens
- Playbooks execute system-level changes; audit trail important
## Performance Characteristics
- Cron-driven or manually triggered deployment cycles
- Lightweight Python sidecar; no heavy computation expected
- Gitea API rate limits are the primary bottleneck
## Cross-References
- Host repo: `Timmy_Foundation/timmy-home`
- Target repo: `Timmy_Foundation/timmy-config`
- Upstream follow-up: timmy-config #823 (broken pytest collection)
- Related genome: target repo ships its own `GENOME.md` on main