Skip to content

Commit 87f6b6c

Browse files
committed
clean the unused part
1 parent 6fa7c16 commit 87f6b6c

11 files changed

Lines changed: 39 additions & 68 deletions

File tree

prototype/agingbench/telemetry/README.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ extractors push it to L3 without extra integration.
8989
```python
9090
from agingbench.telemetry import list_supported_formats
9191
list_supported_formats()
92-
# ['claude_code', 'generic', 'langfuse', 'langsmith',
92+
# ['claude_code', 'generic', 'langfuse',
9393
# 'openai_assistants', 'openhands', 'otlp']
9494
```
9595

@@ -108,9 +108,13 @@ list_supported_formats()
108108
| `openai_assistants` | `thread.message` / `thread.run` / `thread.run.step` objects |
109109
| `openhands` | OpenHands SDK event log (`source`, `action`, `observation`, `llm_metrics`) |
110110
| `langfuse` | Langfuse SDK exports or REST-API JSON (camelCase or snake_case) |
111-
| `langsmith` | LangSmith run JSON — routed through the generic adapter |
112111
| `otlp` | OTLP JSON spans (`gen_ai.*` semconv + legacy `llm.*` namespace) |
113112

113+
LangSmith run JSON works today via `trace_format="generic"` — its field
114+
shape is covered by the generic adapter's aliasing. A dedicated
115+
`langsmith` format will be added once we ship a fixture + adapter-level
116+
test for it.
117+
114118
Each adapter normalises into the canonical `TelemetryRecord`; all
115119
downstream inference is format-agnostic, so the parse-tested adapters
116120
work today if you already have a JSONL in the expected shape — what's
@@ -145,15 +149,14 @@ empty list, not a crash.
145149
## Deployment profiles
146150

147151
A profile encodes domain conventions (outcome-extraction rules,
148-
subject-linkage, mechanism weights, privacy patterns, session
149-
detection):
152+
default privacy patterns, session-detection defaults):
150153

151154
```python
152155
from agingbench.telemetry import list_profiles, load_profile
153156
list_profiles() # ['code_assistant', 'generic']
154157
p = load_profile("code_assistant")
155158
p.outcome_rules # {'pr_merged': 'success', ...}
156-
p.mechanism_weights # {'compression': 0.8, 'revision': 1.5, ...}
159+
p.privacy_patterns # [{'pattern': 'AKIA...', 'replacement': '[AWS_ACCESS_KEY]'}, ...]
157160
```
158161

159162
Override per call:
@@ -362,25 +365,29 @@ extractors, deployment profiles, synthetic-probe orchestrator, ASCII
362365
card renderer, `prepare_trace` preprocessor) are shipped and covered
363366
by the test suite (~85 telemetry-specific tests across
364367
`test_telemetry_adapters.py`, `test_telemetry_stub.py`,
365-
`test_telemetry_v11.py`; 143+ total `prototype/tests/`).
368+
`test_telemetry_v11.py`; 228+ tests total in `prototype/tests/`).
366369

367370
**Trace-format coverage in this release**: Claude Code is verified
368371
end-to-end on real production traces; the `generic` adapter is
369-
verified against fixture data. The remaining five adapters
370-
(`openai_assistants`, `openhands`, `langfuse`, `langsmith`, `otlp`)
371-
pass adapter-level tests against shipped fixtures, but their
372-
*extraction recipes* — the steps needed to dump a JSONL of the right
373-
shape from each live third-party SDK — have not been validated against
374-
current SDK versions and are tracked as future work.
372+
verified against fixture data. The remaining four adapters
373+
(`openai_assistants`, `openhands`, `langfuse`, `otlp`) pass
374+
adapter-level tests against shipped fixtures, but their *extraction
375+
recipes* — the steps needed to dump a JSONL of the right shape from
376+
each live third-party SDK — have not been validated against current
377+
SDK versions and are tracked as future work. LangSmith run JSON is
378+
routable today via `trace_format="generic"`.
375379

376380
## Roadmap
377381

378382
| Milestone | Scope |
379383
|---|---|
380-
| **Next** | End-to-end validation of the five parse-tested adapters against current SDKs (`openai_assistants`, `openhands`, `langfuse`, `langsmith`, `otlp`), promoting each to "verified" as it lands. More outcome extractors (GitHub Actions CI status, Langfuse score events, Slack reactions). Validation correlation study against scenario-derived metrics. |
384+
| **Next** | End-to-end validation of the four parse-tested adapters against current SDKs (`openai_assistants`, `openhands`, `langfuse`, `otlp`), promoting each to "verified" as it lands. Add a dedicated `langsmith` format (currently routes through `generic`). More outcome extractors (GitHub Actions CI status, Langfuse score events, Slack reactions). Validation correlation study against scenario-derived metrics. |
381385
| **Later** | Cross-tenant aggregation with differential privacy. Streaming ingestion. Native protobuf OTLP. |
382386
| **v2** | Multilingual user-correction detection. Workspace-fidelity inference for self-planning agents (S5). |
383387

384388
Contributing a validated recipe for one of the parse-tested adapters
385-
is the highest-leverage way to widen format coverage — see the
386-
top-level `docs/CONTRIBUTING.md`.
389+
is the highest-leverage way to widen format coverage. The top-level
390+
`docs/CONTRIBUTING.md` covers SUT YAMLs and integration adapters;
391+
telemetry-adapter recipes can be contributed by adding a fixture under
392+
`example_traces/`, a `normalize()` implementation under `adapters/`,
393+
and registering the format in `adapters/__init__.py`.

prototype/agingbench/telemetry/adapters/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717

1818
# format name → normaliser
19+
# NOTE: `langsmith` routes through the generic adapter (no dedicated
20+
# normaliser). Kept in the registry for backward compat, but NOT
21+
# advertised as a first-class format in the README until we ship a
22+
# dedicated fixture + adapter-level test for it.
1923
ADAPTERS: dict[str, Callable[[dict], Optional[TelemetryRecord]]] = {
2024
"generic": generic.normalize,
2125
"claude_code": claude_code.normalize,

prototype/agingbench/telemetry/profiles/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
44
A profile encodes (per deployment type):
55
- default outcome-extraction rules
6-
- subject-linkage rules
7-
- mechanism-inference weights
86
- default privacy patterns
97
- session-detection defaults
108
@@ -25,8 +23,6 @@
2523
class Profile:
2624
deployment_type: str
2725
outcome_rules: dict = field(default_factory=dict)
28-
subject_linkage: dict = field(default_factory=dict)
29-
mechanism_weights: dict = field(default_factory=dict)
3026
session_detection: dict = field(default_factory=dict)
3127
privacy_patterns: list = field(default_factory=list)
3228
raw: dict = field(default_factory=dict)
@@ -44,8 +40,6 @@ def load_profile(name: str = "generic") -> Profile:
4440
return Profile(
4541
deployment_type=doc.get("deployment_type", name),
4642
outcome_rules=doc.get("outcome_rules", {}) or {},
47-
subject_linkage=doc.get("subject_linkage", {}) or {},
48-
mechanism_weights=doc.get("mechanism_weights", {}) or {},
4943
session_detection=doc.get("session_detection", {}) or {},
5044
privacy_patterns=doc.get("privacy_patterns", []) or [],
5145
raw=doc,
@@ -63,8 +57,6 @@ def merge_overrides(profile: Profile, overrides: Optional[dict]) -> Profile:
6357
return Profile(
6458
deployment_type=profile.deployment_type,
6559
outcome_rules={**profile.outcome_rules, **overrides.get("outcome_rules", {})},
66-
subject_linkage={**profile.subject_linkage, **overrides.get("subject_linkage", {})},
67-
mechanism_weights={**profile.mechanism_weights, **overrides.get("mechanism_weights", {})},
6860
session_detection={**profile.session_detection, **overrides.get("session_detection", {})},
6961
privacy_patterns=profile.privacy_patterns + (overrides.get("privacy_patterns") or []),
7062
raw=profile.raw,

prototype/agingbench/telemetry/profiles/code_assistant.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ outcome_rules:
1515
completion_rejected: user_rejected
1616
abort: abandoned
1717

18-
subject_linkage:
19-
# In a code workflow, the natural "subject" is the file or function.
20-
primary: file_path
21-
secondary: [function_name, class_name, pr_id]
22-
23-
mechanism_weights:
24-
# In code-assistant deployments revision matters more (consistency
25-
# across edits to the same file); pure-compression matters less since
26-
# the file system absorbs state.
27-
compression: 0.8
28-
interference: 1.0
29-
revision: 1.5
30-
maintenance: 1.0
31-
3218
session_detection:
3319
primary: explicit_session_id # Claude Code, OpenHands provide this
3420
fallback_idle_gap_minutes: 60 # coding sessions can have long pauses

prototype/agingbench/telemetry/profiles/generic.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@ outcome_rules:
1414
user_thumbs_up: success
1515
user_thumbs_down: fail
1616

17-
subject_linkage:
18-
# Default: no cross-session subject linkage.
19-
primary: null
20-
21-
mechanism_weights:
22-
compression: 1.0
23-
interference: 1.0
24-
revision: 1.0
25-
maintenance: 1.0
26-
2717
session_detection:
2818
primary: explicit_session_id
2919
fallback_idle_gap_minutes: 30

prototype/agingbench/telemetry/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class TraceAuditBlock:
126126
deployment_type: str = "generic"
127127
n_sessions_detected: int = 0
128128
n_outcome_events: int = 0
129-
session_detection_mode: str = "idle_gap" # 'explicit_id'|'idle_gap'|'user_id_split'
129+
session_detection_mode: str = "idle_gap" # 'explicit_id'|'idle_gap'
130130
outcome_rules_hash: Optional[str] = None
131131

132132
# Per-mechanism sub-dicts — populated by inference modules.

prototype/agingbench/telemetry/session_detection.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
Strategy (in priority order):
55
1. Explicit session_id field (Langfuse, OpenAI threads, Claude Code)
66
2. Explicit reset markers in user messages (/clear, /reset)
7-
3. user_id grouping + idle-gap split
8-
4. Pure idle-gap split (last resort)
7+
3. Pure idle-gap split (last resort)
98
"""
109
from __future__ import annotations
1110

1211
from collections import defaultdict
13-
from typing import Optional
1412

1513
from .schema import TelemetryRecord
1614

@@ -21,7 +19,6 @@
2119
def detect_sessions(
2220
records: list[TelemetryRecord],
2321
idle_gap_minutes: float = 30.0,
24-
user_id_field: Optional[str] = None,
2522
) -> tuple[list[list[TelemetryRecord]], str]:
2623
"""Return (sessions, mode) where sessions is list of lists and mode is the
2724
detection strategy that fired.
@@ -38,17 +35,6 @@ def detect_sessions(
3835
sessions = [sorted(g, key=lambda r: r.timestamp) for g in groups.values()]
3936
return _stable_session_order(sessions), "explicit_id"
4037

41-
# Strategy 2 + 4: idle-gap split (with optional user-id pre-grouping).
42-
if user_id_field:
43-
by_user = defaultdict(list)
44-
for r in records:
45-
uid = (r.user_id_hash or r.raw.get(user_id_field) or "_anon")
46-
by_user[uid].append(r)
47-
sessions = []
48-
for uid, recs in by_user.items():
49-
sessions.extend(_split_by_idle_gap(recs, idle_gap_minutes))
50-
return _stable_session_order(sessions), "user_id_split"
51-
5238
sessions = _split_by_idle_gap(records, idle_gap_minutes)
5339
return sessions, "idle_gap"
5440

prototype/agingbench/telemetry/trace_to_card.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@
2424
from typing import Any, Optional
2525

2626

27-
# Trace formats the v1 stub knows about.
27+
# Trace formats the v1 stub knows about. NOTE: `langsmith` is included
28+
# (silently routes through the `generic` adapter) for backward compat,
29+
# but is intentionally NOT advertised as a first-class format in the
30+
# README — it ships without a dedicated fixture/test. Users with
31+
# LangSmith run JSON should prefer `trace_format="generic"` going
32+
# forward; a dedicated langsmith adapter + fixture is on the roadmap.
2833
SUPPORTED_TRACE_FORMATS = (
2934
"langfuse", "langsmith", "otlp", "generic", "claude_code",
3035
"openai_assistants", "openhands",

prototype/tests/test_aging_card_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_validate_card_path_missing_file(tmp_path):
9797

9898
def test_sample_card_validates():
9999
"""The fixture sample card (committed in examples/sample_cards/) must validate."""
100-
sample = Path(__file__).parent.parent / "examples" / "sample_cards" / "s1_haiku45_lossy_compress.json"
100+
sample = Path(__file__).parent.parent / "examples" / "sample_cards" / "s1_research_literature_haiku45_lossy_compress.json"
101101
if not sample.is_file():
102102
pytest.skip("sample card not present")
103103
errors = validate_card_path(sample)

0 commit comments

Comments
 (0)