Skip to content

Latest commit

 

History

History
245 lines (194 loc) · 7.76 KB

File metadata and controls

245 lines (194 loc) · 7.76 KB

Morphir-Go Migration Summary

Overview

Successfully migrated Go tooling and code from finos/morphir to finos/morphir-go with complete git history preservation.

What Was Done

1. History-Preserving Code Extraction

  • Used git-filter-repo to extract Go-specific paths from finos/morphir
  • Preserved 615 commits of Git history
  • Extracted paths:
    • cmd/morphir/ - CLI application
    • pkg/ - All Go library packages (17 modules)
    • tests/bdd/ - Behavioral testing
    • .github/workflows/ - CI/CD workflows
    • .goreleaser.yaml - Release configuration

2. Import Path Updates

  • Replaced all occurrences of github.com/finos/morphir with github.com/finos/morphir-go
  • Updated 214 files across the codebase
  • Ensured all imports resolve correctly

3. Code Merge

  • Merged extracted code with --allow-unrelated-histories
  • Resolved merge conflicts (1 file: tests/bdd/scripts/fetch-fixtures.sh)
  • Current HEAD includes latest upstream changes (Go 1.25.6)

4. Build System Modernization

  • Replaced Justfile with mise + TypeScript tasks
    • Created .mise.toml with tool versions
    • Copied 18 TypeScript-based task files from source
    • Tasks use bun as script runner
    • File-based tasks in .config/mise/tasks/
  • Updated CI/CD
    • Changed from setup-just to jdx/mise-action
    • All workflows now use mise run <task>
    • Kept Go setup step for reliability

5. Workspace Configuration

  • Updated go.work to include all 17 modules
  • Added replace directives to all go.mod files for local development
  • Updated bash scripts (mod-tidy.sh, verify.sh) to handle all modules
  • Maintained PowerShell scripts for Windows compatibility

New Modules Added

The migration brought 9 additional Go modules:

  1. pkg/bindings/golang - Go code generation from Morphir IR
  2. pkg/bindings/morphir-elm - Elm interop utilities
  3. pkg/bindings/typemap - Type mapping between languages
  4. pkg/bindings/wit - WebAssembly Interface Types support
  5. pkg/docling-doc - Document processing capabilities
  6. pkg/logging - Structured logging with zerolog
  7. pkg/nbformat - Jupyter notebook format support
  8. pkg/task - Task management system
  9. pkg/toolchain - Toolchain enablement
  10. pkg/vfs - Virtual file system

Total modules: 17 (previously 7)

New CLI Commands

The merged code includes enhanced CLI functionality:

  • morphir about - Display Morphir information
  • morphir decoration - Manage decorations
    • decoration query - Query decorations
    • decoration setup - Set up decoration types
    • decoration type - Manage decoration types
  • morphir golang - Go code generation operations
  • morphir plan - Show execution plan for workflows
  • morphir task - Task management
  • morphir wit - WebAssembly Interface Types operations

Build Verification

✅ Successfully builds morphir CLI (26MB binary)

go build -o bin/morphir ./cmd/morphir
./bin/morphir --version
# morphir version dev

✅ All commands work:

./bin/morphir help
# Shows 12 available commands (previously 7)

Mise Tasks

Available tasks (run with mise run <task> or mise <task>):

Core Development

  • build (alias: b) - Build the morphir CLI
  • test (alias: t) - Run all tests
  • verify (alias: v) - Verify all modules build
  • fmt - Format code
  • fmt-check - Check code formatting
  • lint - Run linters
  • clean - Clean build artifacts

Testing

  • test:bdd - Run BDD tests
  • test:integration - Run integration tests
  • test:integration-morphir-elm - Test morphir-elm interop
  • test-external - Run external tests
  • test-junit - Generate JUnit test reports

Workspace

  • workspace:setup - Set up Go workspace with all modules
  • workspace:sync - Sync workspace dependencies
  • workspace:doctor - Check workspace health

Release

  • release:validate - Validate GoReleaser configuration
  • release:snapshot - Build release snapshot (no publish)
  • release:tags - Manage release tags
  • release:clean-replace - Clean and update replace directives

Documentation

  • docs:schema:convert - Convert schemas
  • docs:schema:verify - Verify schema consistency
  • docs:schema:drift - Check for schema drift
  • docs:llms-txt - Generate LLMs.txt documentation

Fixtures

  • fixtures:fetch - Fetch test fixtures

Files Changed

Added

  • .mise.toml - Mise configuration with tool versions
  • .config/mise/tasks/*.ts - TypeScript-based task files (18 files)
  • .config/mise/tasks/*.py - Python-based task files (4 files)
  • Hundreds of new Go source files from upstream

Modified

  • go.work - Updated with all 17 modules
  • go.work.sum - Workspace checksums
  • All go.mod files - Added replace directives for local development
  • .github/workflows/ci.yml - Uses mise instead of just
  • .github/workflows/release.yml - Uses mise instead of just
  • README.md - Updated build instructions to use mise
  • AGENTS.md - Updated development guidelines

Removed

  • mise.toml - Replaced with .mise.toml + file-based tasks

Kept (for backward compatibility)

  • Justfile - Can be removed after CI validates mise tasks
  • scripts/*.sh and scripts/*.ps1 - Cross-platform scripts

Git History

Before Migration

  • 3 commits in finos/morphir-go
  • Outdated code (last sync unknown)

After Migration

  • 615+ commits with full history
  • Latest: chore(deps): update dependency go to v1.25.6
  • Complete development history from finos/morphir

Merge Commit Chain

  1. 3b2e1ac - Initial plan
  2. 08735f5 - feat: migrate from Justfile to mise.toml
  3. ad89a04 - refactor: update import paths to github.com/finos/morphir-go
  4. 1b6811a - Merge remote-tracking branch 'extraction/main'
  5. a9d5bc6 - feat: merge Go code from finos/morphir with history preservation
  6. dc55863 - fix: add replace directives to all go.mod files

Next Steps

  1. CI Validation - Verify mise tasks work in CI environment
  2. Testing - Run full test suite with new code
  3. Documentation - Update remaining docs referencing Justfile
  4. Remove Justfile - After successful CI validation
  5. Release - Tag and release first version with merged code

Verification Commands

# List available mise tasks
mise tasks

# Run build
mise run build
# or: mise build

# Run tests
mise run test

# Verify all modules
mise run verify

# Check workspace health
mise run workspace:doctor

# Format code
mise run fmt

# Run linters
mise run lint

# Full CI check
mise run fmt-check && mise run verify && mise run test && mise run lint

Migration Timeline

Step Status Details
Extract history ✅ Complete 615 commits filtered
Update imports ✅ Complete 214 files updated
Merge code ✅ Complete 1 conflict resolved
Modernize build ✅ Complete mise + TypeScript tasks
Add replace directives ✅ Complete All go.mod files updated
Build verification ✅ Complete 26MB binary builds successfully
CI validation ⏳ Pending Awaiting PR CI run
Documentation update ⏳ Pending Some docs still reference just
Justfile removal ⏳ Pending After CI validates mise

Success Criteria

  • Git history preserved from finos/morphir
  • All imports updated to github.com/finos/morphir-go
  • Code builds successfully
  • CLI runs and shows enhanced commands
  • Justfile replaced with mise tasks
  • CI updated to use mise
  • All 17 modules included in workspace
  • CI pipeline passes
  • Full test suite passes
  • Documentation updated
  • Justfile removed

References