Skip to content

feat: implement workflow visualization command for #60#77

Merged
crashfrog merged 7 commits into
mainfrom
worktree-agent-a275956c
May 29, 2026
Merged

feat: implement workflow visualization command for #60#77
crashfrog merged 7 commits into
mainfrom
worktree-agent-a275956c

Conversation

@crashfrog
Copy link
Copy Markdown
Member

Summary

Implement torchbase workflow inspect command that renders WDL workflow pipelines as ASCII box diagrams showing task flow, conditionals, and key parameters.

Changes

  • WDL Parser Module (torchbase/workflow_inspect.py):

    • WDLParser: Extracts workflow structure, task definitions, inputs/outputs, and conditionals
    • WorkflowDiagramRenderer: Generates ASCII box diagrams with configurable verbosity
    • inspect_workflow(): Main interface supporting strategy names and torch paths
  • CLI Enhancement (torchbase/cli.py):

    • Added workflow command group
    • Added workflow inspect subcommand with --verbose flag
  • Built-in Workflows (torchbase/workflows/builtin/):

    • fast_typing.wdl: MinHash-only pipeline
    • balanced_typing.wdl: MinHash with conditional alignment
    • sensitive_typing.wdl: Full alignment-based pipeline

Features

  • Accepts built-in strategy names (fast/balanced/sensitive)
  • Accepts torch directory paths (auto-discovers main.wdl)
  • Renders workflow as ASCII box diagram with unicode box-drawing characters
  • Shows conditional branches with ├──[condition]──┐ notation
  • Task names and key parameters displayed by default
  • --verbose flag shows full details including default values and optional parameter markers (?)
  • Detects WDL syntax errors (mismatched braces, missing version, import errors)
  • Error messages are clear and actionable

Test Coverage

All 48 acceptance tests pass:

  • Command existence and signature validation
  • Built-in strategy name resolution
  • Torch directory path handling
  • ASCII diagram rendering and readability
  • Conditional branch visualization
  • Task and parameter display
  • Verbose mode output
  • WDL parsing error handling
  • Output format consistency and quality

Test Plan

  • Run all workflow_inspect tests: pytest torchbase/tests/test_workflow_inspect.py -v
  • Verify linting: flake8 torchbase/workflow_inspect.py
  • Test with built-in strategies: torchbase workflow inspect fast
  • Test with torch paths and WDL files
  • Verify ASCII diagram rendering
  • Verify conditional branch notation
  • Test verbose mode flag

Generated with Claude Code

crashfrog and others added 7 commits May 27, 2026 09:33
Add comprehensive test suite for workflow visualization command:
- Command existence and structure (workflow inspect)
- Built-in strategy support (fast/balanced/sensitive)
- Torch directory path support
- ASCII diagram rendering with boxes and connections
- Conditional branch visualization
- Task parameter display (default and --verbose)
- WDL parsing error handling
- Integration tests with existing workflows

All tests currently FAILING as expected (RED phase).
Feature implementation will make these tests pass.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add workflow inspection command 'torchbase workflow inspect' that renders
WDL workflow pipelines as ASCII box diagrams. Supports built-in strategy
names (fast/balanced/sensitive) and torch directory paths. Includes:

- WDL parser for extracting workflow structure, task flows, and conditionals
- ASCII diagram renderer with task boxes and flow visualization
- Support for conditional branches with clear notation (├──[condition]──┐)
- Task names and key parameters displayed by default
- Verbose flag for full parameter details including defaults and optional markers
- Error detection for WDL syntax errors and import issues
- Three built-in workflow definitions for fast/balanced/sensitive strategies

All 48 tests pass, covering command existence, built-in strategies, torch paths,
ASCII rendering, conditionals, parameters, verbose mode, WDL errors, and output format.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
PR #64 already merged the complete balanced typing workflow implementation
Import paths in WDL are relative to the WDL file location, not the CWD.
The overly strict validation was rejecting valid relative imports.
Let the WDL engine handle import resolution during execution.
- Add import path validation in WDLParser._validate_syntax()
- Pass wdl_dir to WDLParser to enable relative import resolution
- Update fast_typing.wdl and sensitive_typing.wdl to match main branch
  (use task imports instead of inlined tasks)
- All 48 workflow_inspect tests now pass

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
# Conflicts:
#	torchbase/workflows/builtin/fast_typing.wdl
#	torchbase/workflows/builtin/sensitive_typing.wdl
@crashfrog crashfrog merged commit bbc175b into main May 29, 2026
2 checks passed
@crashfrog crashfrog mentioned this pull request May 29, 2026
9 tasks
@crashfrog crashfrog deleted the worktree-agent-a275956c branch May 29, 2026 17:29
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