Skip to content

feat(service): Google Sheets workflow — 3 parallel loops, generic read activity#253

Merged
tonyxiao merged 9 commits intov2from
sheet-workflow
Apr 6, 2026
Merged

feat(service): Google Sheets workflow — 3 parallel loops, generic read activity#253
tonyxiao merged 9 commits intov2from
sheet-workflow

Conversation

@tonyxiao
Copy link
Copy Markdown
Collaborator

@tonyxiao tonyxiao commented Apr 6, 2026

Summary

  • Refactor googleSheetPipelineWorkflow to use 3 parallel loops (liveEventLoop, reconcileLoop, writeLoop) matching the pipelineWorkflow pattern
  • Single GoogleSheetWorkflowState object replaces scattered booleans (setupDone, readComplete, pendingWrites)
  • derivePipelineStatus() + setState() pattern for consistent status reporting
  • EOF-based completion detection replaces deepEqual
  • Rename readGoogleSheetsIntoQueuereadIntoQueue (now generic — reads from source into Kafka)
  • Move row key/number augmentation from read to write activity (only write is Sheets-specific)
  • Extract immutable mergeStateMessage() utility for consistent state merge across activities
  • Rename RowIndexRowIndexMap, rowAssignmentsrowIndexMap for clarity
  • Rename connector type google-sheetsgoogle_sheets (snake_case on the wire)

Test plan

  • pnpm build passes
  • pnpm test — all 23 service tests pass
  • Workflow tests cover: backfill → ready, live events, pause/resume, delete/teardown, catalog discovery

🤖 Generated with Claude Code

tonyxiao and others added 6 commits April 6, 2026 07:50
The backfill logic was consolidated into pipelineWorkflow's
state machine in #251. The standalone backfill workflow is no
longer referenced or needed.

Committed-By-Agent: claude
…read activity

- Split readLoop into liveEventLoop + reconcileLoop + writeLoop
- Single GoogleSheetWorkflowState object replaces scattered booleans
- derivePipelineStatus() + setState() pattern matches pipeline-workflow.ts
- EOF-based completion detection replaces deepEqual
- Rename readGoogleSheetsIntoQueue → readIntoQueue (now generic)
- Move row key/number augmentation from read to write activity
- Treat SourceState as atomic in workflow; activities own merge logic
- Rename RowIndex → RowIndexMap, state → sourceState for clarity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
…signatures

- Postgres test: use pipelineId arg (not full config), add pipelineStore,
  fix signal names (source_input, desired_status)
- Google Sheets test: use googleSheetPipelineWorkflow, nested destination
  envelope format, pre-populate in-memory pipeline store
- CLI: default --data-dir to ~/.stripe-sync for all commands

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
…sage utility

- Rename RowIndex → RowIndexMap, rowAssignments → rowIndexMap for clarity
- Extract immutable mergeStateMessage() utility in activities/_shared.ts
- Remove redundant state variable aliases in write activity
- Use assignment pattern (state = mergeStateMessage(state, msg)) consistently

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Committed-By-Agent: claude
Follow snake_case API convention for the google sheets destination
type identifier (registry key, type discriminator, nested config key).
Package/directory names unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
When DATA_DIR is set, all commands (serve/worker/webhook) use it as the
default data directory without requiring an explicit --data-dir flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
@tonyxiao tonyxiao changed the title feat(service): google sheet pipeline workflow with 3-loop architecture feat(service): Google Sheets workflow — 3 parallel loops, generic read activity Apr 6, 2026
@tonyxiao tonyxiao marked this pull request as ready for review April 6, 2026 20:20
tonyxiao and others added 3 commits April 6, 2026 13:47
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
@tonyxiao tonyxiao merged commit 553fe18 into v2 Apr 6, 2026
13 checks passed
@tonyxiao tonyxiao deleted the sheet-workflow branch April 6, 2026 22:26
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