Skip to content

refactor(api): consolidate runs endpoints into investigations#90

Merged
bordumb merged 11 commits intomainfrom
fn-29
Jan 27, 2026
Merged

refactor(api): consolidate runs endpoints into investigations#90
bordumb merged 11 commits intomainfrom
fn-29

Conversation

@bordumb
Copy link
Copy Markdown
Owner

@bordumb bordumb commented Jan 27, 2026

Follow up PR for missed commit files related to #89

bordumb and others added 10 commits January 27, 2026 00:01
Add new Rich formatting functions to display.py:
- format_timestamp(): elapsed time as [MM:SS]
- format_hypothesis(): blue-bordered hypothesis panels
- format_query(): yellow-bordered SQL with syntax highlighting
- format_evidence_item(): green/red panels based on support
- format_synthesis(): cyan panel with root cause and recommendations

All formatters handle missing fields gracefully and truncate
long SQL content (>20 lines) with ellipsis indicator.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Panels accumulate progressively (don't replace each other)
- Each panel shows [MM:SS] elapsed timestamp prefix
- Hypotheses numbered sequentially (#1, #2, etc.)
- Event type mapping: hypothesis_testing, run_evidence, run_completed
- Timeline persists after completion (transient=False)
- Heartbeat events refresh display without new panels
- Ctrl+C exits cleanly with code 130
- Updated test to match new "Synthesis" output format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add --no-stream flag: waits silently, outputs final result only
- Deprecate --no-watch (still works, exits immediately after URL)
- Add _wait_for_completion() helper for silent waiting
- Support both JSON and Rich output modes with --no-stream
- Exit code 0 on success, 1 on failure

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove indent=2 from JSON output (NDJSON requires single-line)
- Add separators=(",", ":") for compact output
- Use print() instead of console.print() to avoid ANSI codes
- Each event is now one parseable JSON line

Output is now compatible with jq streaming:
  dataing run start ... --json | jq .event

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Detect non-TTY stdout with sys.stdout.isatty()
- Add _watch_run_plain_text() for piped output
- Plain text format: [MM:SS] event_type: message
- No ANSI codes when output is piped to file/tee
- Updated test to accept both Rich and plain text formats

Works with: dataing run start ... > output.txt
Works with: dataing run start ... | tee output.log

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 20 new test cases for timeline display functionality:
- TestFormatTimestamp: elapsed time formatting
- TestFormatHypothesis: blue panels with numbering
- TestFormatQuery: yellow panels with SQL highlighting, truncation
- TestFormatEvidenceItem: green/red/yellow based on verdict
- TestFormatSynthesis: cyan panels with recommendations
- TestTimelineFormattersEdgeCases: missing data, mock objects

All 108 CLI tests now pass.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update cli.md with progressive timeline display documentation
- Add color coding table for event types (hypothesis, query, evidence, synthesis)
- Document --no-stream flag for wait-and-output behavior
- Document NDJSON streaming format with examples
- Document non-TTY plain text fallback
- Update justfile demo output with explicit CLI commands:
  - dataing run start with streaming timeline
  - dataing --json for NDJSON output
  - dataing --no-stream for scripted usage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use main.orders, main.events etc. (correct for DuckDB demo)
- Schema qualification is standard for real databases:
  - PostgreSQL: schema.table (e.g., public.orders)
  - Snowflake: database.schema.table
  - DuckDB: schema.table (e.g., main.orders)
- Keep user_id (matches demo fixture anomaly)
- Update justfile demo commands with correct table names

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add missing --date flag to CLI that maps to anomaly_date in the SDK,
ensuring CLI investigations target the correct date like the GUI does.

- Add --date option (YYYY-MM-DD format, defaults to today)
- Pass anomaly_date to start_investigation() call
- Add test for --date flag
- Update CLI docs with --date in options table and examples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove standalone /runs endpoints, consolidate into /investigations
- Update SDK client with streaming support for investigations
- Regenerate frontend API client
- Fix unused variable warnings in tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bordumb bordumb self-assigned this Jan 27, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
dataing Ready Ready Preview, Comment Jan 27, 2026 2:54am
dataing-app Ready Ready Preview, Comment Jan 27, 2026 2:54am
dataing-docs Ready Ready Preview, Comment Jan 27, 2026 2:54am

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