fix(dashboard): export Signal/SpanComment/AlertFiring types + appendJsonl#16
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's broken
A locally-pending feature branch (alerts + signals + comments + timeline) imports symbols from
app/lib/types.tsandapp/lib/jsonl-writer.tsthat were never merged. Any clean checkout that also pulled the WIP files would failtsc --noEmitwith 13TS2305: has no exported membererrors.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:SignalKindsignals.tsSIGNAL_LABELSeverity"low" | "med" | "high"Modality"chat" | "voice" | "agent" | "rag"SignalSpanCommentPOST /api/commentshandlerAlertFiringloadAlerts()consumerapp/lib/jsonl-writer.ts— addsappendJsonl<T>(filename, record)used byPOST /api/commentsto append tocomments.jsonl.Why narrow shapes
AlertFiringin particular is kept minimal on purpose — the alerts page only usesfirings.lengthand anEmptyfallback today. Widen later when richer rendering lands. Better to under-specify than to lock in a contract the in-progress feature might change.Verified
Test plan
tsccleanly. Subsequent PRs can shipsignals.ts+ the alerts/comments/timeline routes.🤖 Generated with Claude Code