Skip to content

Enforce terra.v1 contract with policy gating and TraceMacApp controls#11

Closed
christopherkarani wants to merge 26 commits into
mainfrom
codex/add-ondevice-inference-telemetry
Closed

Enforce terra.v1 contract with policy gating and TraceMacApp controls#11
christopherkarani wants to merge 26 commits into
mainfrom
codex/add-ondevice-inference-telemetry

Conversation

@christopherkarani

Copy link
Copy Markdown
Owner

Summary

  • Hardened the Terra core to synthesize required terra.v1 attributes, apply deterministic compliance blocking/audit, and ship recommendation anti-oscillation controls.
  • Added OTLP ingest runtime gating, canonical CoreML timing/naming, explicit llama.cpp span-handle callbacks, deterministic HTTP runtime resolution, and TraceKit decoding parity for the new metadata.
  • Wired persisted TraceMacApp volume/runtime controls plus high-volume rendering safeguards and aligned docs/schema/fixtures with the enforced contract.

Testing

  • Not run (not requested).

christopherkarani and others added 26 commits February 6, 2026 07:54
Bug fixes:
- BUG-1: Move trace loading off main thread with Task.detached
- BUG-2: Replace blocking waitUntilExit with async continuation
- BUG-3: Cache timeline layout computation outside draw(_:)
- BUG-4: Cache ISO8601DateFormatter as stored property
- BUG-5: Fix selectTrace to search filteredTraces, not all traces

Implementation gaps:
- GAP-1: Add App Sandbox entitlements for production readiness
- GAP-2: Add 5MB log rotation with 2 backup files
- GAP-3: Disable Privacy Policy/EULA/Updates menu items when unconfigured
- GAP-4: Add VoiceOver accessibility to TraceTimelineView
- GAP-8: Register explicit UserDefaults via register(defaults:)

Test coverage:
- TerraCoreMLTests (7 tests): compute unit mapping, attribute keys
- AppCoordinatorTests (14 tests): menu validation, license status
- AppLogTests (5 tests): file creation, tags, rotation
- AppSettingsTests (5 tests): defaults, round-trips
- SampleTracesTests (3 tests): file creation, JSON validity
- TraceDirectoryWatcherTests (4 tests): lifecycle, callbacks

All 81 tests pass (14 XCTest + 67 Swift Testing).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dings

SDK correctness:
- Fix race window in installOpenTelemetry where lock released before setup
  completes (H1) — use defer pattern to hold lock through entire setup
- Add same-config concurrent install test (H1)
- Add defer guard to Runtime.install() for future-proofing (M1→L)
- Fix @unchecked Sendable comment to accurately describe OTel SDK threading (L1)
- Add end-to-end privacy enforcement test (M4)

TraceMacApp features:
- Add "Export Selected/All Traces" commands with JSON export (H2)
- Add local OTLP/HTTP receiver on configurable port for network ingestion (H4)
- Add p50/p95/p99 latency percentiles to dashboard KPI cards (H3)
- Add trace retention policy with configurable TTL and auto-pruning (M5)

Test & CI improvements:
- Fix TerraMetricsTests false-positive — tests now verify behavior (M2)
- Fix TraceDirectoryWatcher flaky test via debounce injection (M3)
- Add CI API breaking changes check for SDK targets on PRs (L5)
- Add TerraTraceKit test suite (21 tests)

Code quality:
- Fix TraceDecoder error to include per-span failure context (L2)
- Replace Task.detached with Task(priority: .userInitiated) (L3)
- Split README into separate SDK vs TraceMacApp capability sections (M6)

All 81 tests pass. Build clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rendering

Move trace page size, timeline marker cap, event row limits, runtime/source filters, and timeline zoom into AppSettings-backed AppState so high-volume behavior is deterministic and persisted across launches.\n\nAlso finish inspector/tab wiring for lifecycle+policy events, enforce row-limit application in AppKit detail tables, and add tests for persistence, marker aggregation behavior, and high-volume UI limits to prevent regressions under dense streaming traces.
Align convention docs, JSON schema, and TerraV1 fixtures/tests with the enforced streaming contract: per-token lifecycle events are canonicalized as  and token attributes use  keys.\n\nThis removes schema/fixture drift from runtime behavior and keeps fixture validation authoritative for terra.v1 ingest and UI decode paths.
…absent

Remove local wall-clock fallback deltas in AIResponseStreamParser by anchoring lifecycle timing to monotonic clocks unless provider-created timestamps are present. This keeps streaming attribution stable under async parsing and satisfies the no-wall-clock timing guardrail for critical runtime paths.
Keep the dev-cutover contract strict by classifying lifecycle markers only from  and . This avoids introducing a UI-level backward-compatibility layer in the terra.v1-only release.
Replaces NavigationSplitView with GeometryReader-based layout: runtime sidebar,
center flow graph/tree/timeline, and bottom span event stream panel. Adds
progressive node reveal, animated chevrons, scroll-to-selected, colored status
indicators, resizable divider with drag feedback, and accessibility labels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rewrote README with hero section, problem statement, quick start,
architecture diagram, and scannable feature tables. Added comprehensive
TERRA_FEATURES.md (25 features), HTML feature page, and CLAUDE.md for
contributor onboarding. Widened TerraTelemetryClassifier access to public.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@christopherkarani

Copy link
Copy Markdown
Owner Author

Superseded by #15, which consolidates the still-valid changes from the current open PR set onto main and intentionally skips stale or conflicting churn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant