Skip to content

Add workflow export bundle endpoint and deterministic serialization#162

Closed
akgohain wants to merge 1 commit intomainfrom
codex/add-backend-endpoint-to-export-workflow-bundle
Closed

Add workflow export bundle endpoint and deterministic serialization#162
akgohain wants to merge 1 commit intomainfrom
codex/add-backend-endpoint-to-export-workflow-bundle

Conversation

@akgohain
Copy link
Copy Markdown
Collaborator

Motivation

  • Provide a backend endpoint to export a reproducible workflow bundle containing session snapshot, ordered events, and referenced artifact paths with existence flags.
  • Make exported bundles deterministic (stable schema version and ordering) and safe when referenced files are missing.

Description

  • Add a new router with POST /api/workflows/{workflow_id}/export-bundle that returns a typed WorkflowExportBundle response model (server_api/workflow/router.py).
  • Introduce Pydantic models for the bundle payload including WorkflowExportBundle, WorkflowEvent, and WorkflowArtifactEntry (server_api/workflow/models.py).
  • Implement build_export_bundle in server_api/workflow/service.py which sorts events chronologically (by timestamp then id), discovers artifact paths from the session snapshot and events when artifact_paths is not provided, and produces exists: true/false per artifact without raising on missing files.
  • Mount the workflow router in the main app by including it in server_api/main.py and add focused unit tests (tests/test_workflow_export_bundle.py) that cover the happy path and explicit artifact path / missing-file behavior.

Testing

  • Ran PYTHONPATH=. pytest -q tests/test_workflow_export_bundle.py which executed the new tests and produced 2 passed.
  • Attempted uv run pytest -q tests/test_workflow_export_bundle.py which failed in this environment due to an unrelated editable-package metadata issue for pytorch_connectomics (packaging error), not the new logic.

Codex Task

@akgohain
Copy link
Copy Markdown
Collaborator Author

Consolidated into draft PR #165 (feat/codex-wave-integration). Closing this source draft to keep review in one place.

@akgohain akgohain closed this Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant