Skip to content

feat(rig-ytn.2): Dolt-backed Workflow Timeline Export#72

Merged
thoreinstein merged 12 commits intorig-v1from
feat/rig-ytn.2-dolt-timeline-export
Mar 2, 2026
Merged

feat(rig-ytn.2): Dolt-backed Workflow Timeline Export#72
thoreinstein merged 12 commits intorig-v1from
feat/rig-ytn.2-dolt-timeline-export

Conversation

@thoreinstein
Copy link
Owner

Overview

This PR enhances the rig timeline command to provide a unified chronological view of manual shell commands (SQLite) and internal system/workflow events (Dolt). It introduces ticket-based event tagging, checkpoint diffing, and a flexible markdown formatter.

Key Changes

  • Unified Timeline: Merges SQLite shell history with Dolt workflow events.
  • Ticket Tagging: Implemented TicketMetadataSetter interface for retroactive and proactive event tagging in the Dolt store.
  • Checkpoint Visualization: Added --show-diffs flag utilizing Dolt system tables (dolt_diff_workflow_events).
  • Robustness:
    • Deterministic diff summary ordering.
    • Stale section removal (including diff blocks) on note refresh.
    • Metadata preservation across workflow resume boundaries.

Verification Results

  • Tests: 344 passing tests (cmd, pkg/workflow, pkg/history, pkg/events).
  • Regression: Added specific coverage for resume tagging and note cleanup edge cases.
  • Lint: golangci-lint clean.

…rying

- Update cmd/timeline to reuse DatabaseManager and handle errors gracefully
- Harden pkg/events/reader with SQL LIKE escaping and iterate error checks
- Add robustness to pkg/events/database backfill (idempotency)
- Refactor history/template for modular rendering
- Expand test coverage for edge cases (idempotency, null metadata, missing commits)
…erminism

- Initialize event logger ticket in Resume to ensure post-resume events are correctly tagged
- Sort correlation IDs in generateDiffSummary for deterministic output ordering
Update removeExistingTimeline to detect and remove ## Workflow Checkpoint Diffs
headers. This prevents duplicate or stale diff summaries from accumulating in
ticket notes when the timeline is regenerated with --show-diffs.
…anup

- Add TicketMetadataSetter interface to events package
- Update merge engine to use interface-based tagging
- Add TestResume_DoltTicketTagging to verify tagging on resume
- Add TestRemoveExistingTimeline_OnlyDiffSection to verify diff section cleanup
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enhances the rig timeline command to produce a unified, chronological markdown timeline combining local shell command history with Dolt-backed workflow/system events, including optional checkpoint diff summaries and ticket-based event tagging.

Changes:

  • Add ticket metadata tagging/backfill support to the Dolt event logger and wire it into workflow Run/Resume.
  • Introduce unified timeline data types + markdown formatter to interleave commands and workflow events.
  • Extend rig timeline to query Dolt events, optionally render checkpoint diffs, and cleanly remove old timeline/diff sections from notes.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
cmd/timeline.go Builds unified entries from commands + Dolt events; adds --show-diffs; removes existing workflow timeline/diff sections; generates diff summaries.
cmd/timeline_test.go Updates flag expectations and expands note-cleanup cases for workflow timeline + diff sections.
pkg/history/types.go Adds unified timeline model (UnifiedEntry, EntryKind, simplified Event).
pkg/history/template.go Refactors command formatting helpers and adds FormatUnifiedTimeline for mixed command/event output.
pkg/history/template_test.go Adds coverage for unified timeline rendering and chronological ordering.
pkg/workflow/merge.go Sets ticket on the event logger after gather; backfills metadata for earlier events; initializes ticket on resume.
pkg/workflow/workflow_test.go Adds resume test ensuring ticket is set on the event logger before resuming steps.
pkg/events/logger.go Adds TicketMetadataSetter, ticket storage with mutex, metadata JSON injection, and BackfillTicket forwarding.
pkg/events/logger_test.go Adds integration tests verifying metadata ticket write and NULL metadata when no ticket is set.
pkg/events/database.go Adds BackfillTicket helper to retro-tag events with ticket metadata.
pkg/events/database_test.go Adds integration tests for backfill behavior and idempotency (no overwrite of existing metadata).
pkg/events/reader.go Adds queries for events by ticket and Dolt diff entries for a workflow correlation ID.
pkg/events/reader_test.go Adds integration tests for querying events by ticket and correlation diffs, including missing-commit behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Improve SQL LIKE escaping logic in reader
- Use SliceStable for deterministic timeline sorting
- Refine JSON_EXTRACT fallback condition
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Fix logical error in JSON_EXTRACT fallback condition
- Ensure deterministic completion commit selection with ORDER BY
- Scope checkpoint diffs by correlation_id for better accuracy
- Use fmt.Fprintf for more idiomatic markdown generation
- Final DRY refactor of ticket tagging logic in merge engine
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Enhance event query determinism with id tie-breaker
- Improve timeline rendering with stable sorting and event precedence
- Fix JSON_EXTRACT fallback logic to be more specific
- Refine checkpoint diff queries with ordering and correlation scoping
- Minor idiomatic string formatting improvements
@thoreinstein thoreinstein merged commit 680e282 into rig-v1 Mar 2, 2026
7 checks passed
@thoreinstein thoreinstein deleted the feat/rig-ytn.2-dolt-timeline-export branch March 2, 2026 17:48
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.

2 participants