Skip to content

fix(dashboard): export Signal/SpanComment/AlertFiring types + appendJsonl#16

Merged
OmkarRayAI merged 1 commit into
mainfrom
fix/missing-dashboard-types
Jun 5, 2026
Merged

fix(dashboard): export Signal/SpanComment/AlertFiring types + appendJsonl#16
OmkarRayAI merged 1 commit into
mainfrom
fix/missing-dashboard-types

Conversation

@OmkarRayAI

Copy link
Copy Markdown
Owner

What's broken

A locally-pending feature branch (alerts + signals + comments + timeline) imports symbols from app/lib/types.ts and app/lib/jsonl-writer.ts that were never merged. Any clean checkout that also pulled the WIP files would fail tsc --noEmit with 13 TS2305: has no exported member errors.

The features themselves (app/lib/signals.ts, app/app/alerts/, app/app/api/comments/, app/components/SpanComments.tsx, app/components/TimelineView.tsx) are unfinished — this PR does not ship them. It just adds the missing type definitions + one helper export so the feature branch compiles and can ship later as a follow-up.

What this PR adds

app/lib/types.ts — six new type exports, derived from the only authoritative usage sites:

Export Source Shape
SignalKind signals.ts SIGNAL_LABEL union of 14 kinds
Severity signal records "low" | "med" | "high"
Modality detector pipeline "chat" | "voice" | "agent" | "rag"
Signal detector output id, trace_id, span_id, kind, severity, source, title, evidence, ts, modality
SpanComment POST /api/comments handler id, trace_id, span_id, author, text, ts
AlertFiring loadAlerts() consumer id, kind, count, threshold, window_min, channel, ts

app/lib/jsonl-writer.ts — adds appendJsonl<T>(filename, record) used by POST /api/comments to append to comments.jsonl.

Why narrow shapes

AlertFiring in particular is kept minimal on purpose — the alerts page only uses firings.length and an Empty fallback today. Widen later when richer rendering lands. Better to under-specify than to lock in a contract the in-progress feature might change.

Verified

cd app && npx tsc --noEmit       # 0 errors
pytest -q tests/                  # 106 passed, 14 skipped (unchanged)

Test plan

  • CI green (Python + dashboard typecheck + lint)
  • After merge, the WIP feature branch can rebase onto main and tsc cleanly. Subsequent PRs can ship signals.ts + the alerts/comments/timeline routes.

🤖 Generated with Claude Code

…sonl helper

A locally-pending feature branch (alerts + signals + comments + timeline)
imports these symbols from app/lib/types.ts and app/lib/jsonl-writer.ts,
but the type definitions and helper export were never merged. The
result was that any clean checkout that also pulled the WIP files
would fail tsc with a wall of TS2305 errors.

The shapes are derived directly from the only authoritative usage site:
  - signals.ts (detector pipeline, Signal/Severity/Modality/SignalKind)
  - app/api/comments/route.ts (POST handler, SpanComment fields)
  - app/app/alerts/page.tsx (loadAlerts() consumer, AlertFiring shape)

What this PR adds
-----------------
app/lib/types.ts
  + SignalKind     enumerates all 14 detectable signal kinds (must
                   stay in sync with SIGNAL_LABEL/SIGNAL_TONE in
                   app/lib/signals.ts)
  + Severity       low | med | high
  + Modality       chat | voice | agent | rag
  + Signal         id, trace_id, span_id, kind, severity, source,
                   title, evidence, ts, modality
  + SpanComment    id, trace_id, span_id, author, text, ts (matches
                   the POST /api/comments handler exactly)
  + AlertFiring    id, kind, count, threshold, window_min, channel, ts
                   (kept narrow on purpose - the alerts page only
                   uses .length and Empty fallback today; widen if
                   richer rendering lands)

app/lib/jsonl-writer.ts
  + appendJsonl<T>(filename, record)
                   minimal helper used by POST /api/comments to
                   append to comments.jsonl. Mirrors the existing
                   appendFileSync pattern already in TraceBuilder.flush().

Note
----
This PR does NOT commit any of the WIP source files (app/app/alerts/*,
app/app/signals/*, app/app/api/comments/*, app/app/voice/*,
app/components/SpanComments.tsx, app/components/TimelineView.tsx,
app/lib/signals.ts, scripts/seed_observability.py). Those remain
unstaged in the working tree as the in-progress feature work they are.

Verified
--------
  cd app && npx tsc --noEmit       0 errors
  pytest -q tests/                  106 passed, 14 skipped (unchanged)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@OmkarRayAI OmkarRayAI merged commit 517312a into main Jun 5, 2026
4 checks passed
@OmkarRayAI OmkarRayAI deleted the fix/missing-dashboard-types branch June 5, 2026 14:16
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