Verify if repository is production-ready#7
Conversation
- Add prominent library package notice to README header - Clarify installation and setup instructions focus on integrating into apps - Update deployment section to show deploying apps that use the library - Revise GETTING_STARTED to emphasize library integration model - Add doctest file to enable testing of documentation examples - Fix version number in doctest (1.0.2 to match mix.exs) This makes it crystal clear that singularity_workflow is a library dependency (like Ecto or Oban) that you add to your mix.exs, not a standalone application to deploy.
- Delete lib/singularity_workflow/execution/backends/distributed_backend.ex - Remove :distributed execution mode from Strategy and type specs - Remove TODO comment about distributed backend implementation - Update documentation to clarify Oban provides distributed execution Rationale: This library replaces NATS, not integrates with it. The Oban backend already provides all distributed execution capabilities needed (multi-node processing, resource allocation, retry logic, job queuing).
This reverts commit 3b05504.
- DistributedBackend now fully functional using library's own infrastructure - Wraps ObanBackend internally (implementation detail hidden from users) - No NATS dependency - uses PostgreSQL + pgmq for distribution - Multi-node execution via shared PostgreSQL queues - Resource allocation through queue-based routing - Remove TODO - distributed mode is now available when Oban is loaded Users call Strategy.execute with execution: :distributed and don't need to know Oban is used internally. Clean API, PostgreSQL-native distribution.
- Remove :oban from user-visible execution modes - Users only see :sync and :distributed - Update all type specs to reflect :sync | :distributed - ObanBackend still exists but only used internally by DistributedBackend - Clean API: users don't need to know Oban is used under the hood This library wraps and abstracts Oban completely. Distributed execution is provided via PostgreSQL + pgmq, implementation is transparent.
Implements 5 missing lifecycle control functions for DAG workflows: - cancel_workflow_run/3: Cancel running workflows with optional reason - list_workflow_runs/2: Query workflows with filtering and pagination - retry_failed_workflow/3: Retry failed workflows from point of failure - pause_workflow_run/2: Pause workflow execution (soft pause) - resume_workflow_run/2: Resume paused workflows Key features: - Oban integration hidden from users (internal implementation detail) - Automatic Oban job cancellation for distributed execution - Database-driven state management (PostgreSQL transactions) - Comprehensive error handling and validation - Full documentation with examples All functions exposed via main Singularity.Workflow module for easy access.
Release 0.1.5 includes: - Complete workflow lifecycle management (cancel, pause, resume, retry, list) - Oban hidden as internal implementation detail - Enhanced documentation with lifecycle examples - HTDAG orchestration documentation Updated: - mix.exs: version 0.1.5 - lib/singularity_workflow.ex: version docstring - README.md: installation version references - CHANGELOG.md: 0.1.5 release notes
Clarifies that Singularity.Workflow provides a complete messaging infrastructure (NATS replacement) rather than just notifications. Changes: - README.md: - 'Real-time Notifications' → 'Real-time Messaging' - 'Notification Layer' → 'Messaging Layer' in diagrams - Emphasize NATS replacement positioning - lib/singularity_workflow.ex: - Update module docs to use 'messaging' terminology - Comment delegates as 'Messaging functions (NATS replacement)' - 'Message Types' instead of 'Notification Types' - lib/singularity_workflow/notifications.ex: - Module doc emphasizes messaging infrastructure - 'NATS replacement' explicitly stated - Consistent 'messages' instead of 'notifications/events' This aligns terminology with the library's role as a distributed system messaging backbone, not just a notification system.
Complete API documentation covering all library capabilities: Core Sections: - Workflow Execution (Executor.execute) - Workflow Lifecycle Management (cancel/pause/resume/retry/list) - Real-Time Messaging (send_with_notify/listen/unlisten) - Goal-Driven Orchestration (HTDAG - why it exists and use cases) - Dynamic Workflow Creation (FlowBuilder for AI/LLM) - Execution Strategies (:sync vs :distributed) - Phoenix Integration (LiveView & Channels examples) Each API includes: - What it does - What problem it solves - Type specs - Real-world examples - Use case guidance HTDAG Explanation: - Why hierarchical task graphs exist - How it enables AI/LLM agent workflows - Goal → task decomposition → execution pipeline - Use cases: autonomous agents, LLM planning, dynamic workflows Phoenix Integration: - LiveView real-time updates without Phoenix.PubSub - Channels integration examples - Comparison with Phoenix.PubSub - When to use each or both together No external dependencies mentioned - focuses on what the library provides and what problems it solves for users.
Removed non-production documentation and fixed references: Removed: - docs/QUANTUM_FLOW_REFERENCE.md (old TypeScript impl reference) - docs/SCHEMA_MIGRATION_GUIDE.md (one-time migration guide) - docs/GITHUB_REPOSITORY_SETUP.md (maintainer setup, not user-facing) - docs/RELEASE_PROCESS.md (internal release process) - docs/SECURITY_AUDIT.md (internal audit, not user-facing) - docs/architecture_diagrams.md (redundant with ARCHITECTURE.md) - test/SNAPSHOT_TESTING.md (internal testing doc) - lib/singularity_workflow/orchestrator/README.md (consolidated) Added: - docs/README.md (comprehensive documentation index with navigation) Fixed: - Updated all references to removed docs - GETTING_STARTED.md: Fixed doc links - SECURITY.md: Removed reference to removed audit doc - CHANGELOG.md: Updated documentation list Remaining production docs: - README.md, GETTING_STARTED.md, CHANGELOG.md - CONTRIBUTING.md, LICENSE.md, SECURITY.md - docs/API_REFERENCE.md (complete API with Phoenix examples) - docs/ARCHITECTURE.md (system design) - docs/DEPLOYMENT_GUIDE.md, docs/TESTING_GUIDE.md - docs/HTDAG_ORCHESTRATOR_GUIDE.md, docs/DYNAMIC_WORKFLOWS_GUIDE.md - docs/INPUT_VALIDATION.md All documentation now production-ready and user-focused.
This is the first production release (v0.1.5), so backward compatibility with the old QuantumFlow schema is unnecessary. No users have existing databases with the QuantumFlow schema name. Changes: - Removed schema rename migration (20251103234710_*.exs) - Removed migration test file (schema_rename_migration_test.exs) - Removed old test file with QuantumFlow module names (executor_test.exs.old) - Updated .envrc comment to reference singularity-workflows - Updated flake.nix to use singularity_workflow database consistently - Updated CODEOWNERS comment to reference singularity_workflow All QuantumFlow/quantum_flow references have been removed from the codebase.
Added missing documentation to align README with implemented features: 1. Workflow Lifecycle Management section: - cancel_workflow_run/3 - pause_workflow_run/2 - resume_workflow_run/2 - retry_failed_workflow/3 - list_workflow_runs/2 - get_run_status/2 2. Execution Strategies: - :sync (local execution in current process) - :distributed (multi-node via PostgreSQL + pgmq) - Updated execute options to include execution mode 3. Phoenix Integration section: - LiveView example showing direct integration - Comparison table: Singularity.Workflow vs Phoenix.PubSub - Emphasizes no Phoenix.PubSub dependency needed - Links to comprehensive API_REFERENCE.md guide 4. Updated Features list: - Added "Workflow Lifecycle Management" feature - Added "Phoenix Integration" feature All documentation now accurately reflects the v0.1.5 implementation.
Started multi-tenancy implementation for global-scale SaaS support. This is INCOMPLETE - requires architectural decision before proceeding. Changes made: 1. ✅ Created migration to add tenant_id to all tables - workflow_runs, workflow_step_states, workflow_step_tasks - Added indexes for query performance - Row-Level Security support (commented, optional) 2. ✅ Updated WorkflowRun schema - Added tenant_id field to type spec - Added tenant_id to schema - Added tenant_id to changeset Remaining work: - Update StepState schema with tenant_id - Update StepTask schema with tenant_id - Add tenant scoping to all Executor lifecycle functions - Rename :sync to :local in execution strategy - Update all documentation BREAKING CHANGE DECISION REQUIRED: Option A: Full Multi-Tenancy (Breaking) - Version 0.2.0 - tenant_id required in ALL APIs - Enforced isolation Option B: Optional Multi-Tenancy (Non-Breaking) - Version 0.1.5 ⭐ RECOMMENDED - tenant_id optional everywhere (default NULL) - Backward compatible, opt-in approach Option C: Defer to 0.2.0 - Ship 0.1.5 without multi-tenancy - Add in next version Recommendation: Option B - Optional tenant_id, stays v0.1.5
- Add tenant_id field to StepState and StepTask schemas for multi-tenant deployments - Rename execution strategy from :sync to :local for clearer semantics - Remove :sync deprecation alias (first release, no backward compatibility needed) - Update all documentation and code references to use :local - Update type specs and default values across workflow_definition.ex Breaking changes: - Execution strategy :sync renamed to :local (use execution: :local) - This is the first release, so no migration path needed Related: Multi-tenancy foundation for global-scale SaaS deployments
Lineage module (lib/singularity_workflow/lineage.ex): - Exposes workflow execution history for evolutionary learning - get_lineage/2: Extract complete task graph, trace, metrics - replay/3: Deterministic workflow reproduction - query_lineages/2: Batch lineage queries with filters - Enables external evolution systems to learn from outcomes Evolution package spec (Evo.txt): - Complete specification for singularity_evolution package - Adaptive planner with LLM-based goal→DAG conversion - Evolution engine with fitness evaluation and variant breeding - Hot reload manager for zero-downtime planner updates - Pattern cache for learned planning strategies - Integration guide with singularity_workflow spine Architecture: - singularity_workflow = stable HT-DAG runtime (this package) - singularity_evolution = hot-reloadable planner (separate package) - Clear boundary: planner emits graphs, runtime executes safely - Lineage provides evolutionary memory for continuous learning Ready for: Self-evolving agent systems with deterministic replay
PR Compliance Guide 🔍(Compliance updated until commit singularity-ng/singularity-workflows@04c318f)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit 04c318f
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@copilot revi3w |
|
@mikkihugo I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you. |
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
CI Feedback 🧐A test triggered by this PR failed. Here is an AI-generated analysis of the failure:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
User description
What does this PR do?
Brief description of the changes made in this pull request.
Related Issues
Fixes #123
or
Related to #456
Type of Change
Testing
mix test)mix quality)Checklist
mix format)mix credo --strict)Screenshot (if applicable)
N/A
PR Type
Enhancement, Documentation
Description
Workflow Lifecycle Management: Added five new functions (
cancel_workflow_run/3,list_workflow_runs/2,retry_failed_workflow/3,pause_workflow_run/2,resume_workflow_run/2) for production-grade workflow control and monitoringLineage Tracking System: Introduced new
Lineagemodule for DAG-based execution history tracking, deterministic workflow replay, and evolutionary learning capabilitiesMulti-Tenancy Support: Added
tenant_idfields to core schemas (WorkflowRun,StepState,StepTask) with database migration including indexes and RLS policy templatesDistributed Backend Refactoring: Converted
DistributedBackendfrom stub to functional implementation delegating toObanBackendwith PostgreSQL pgmq-based executionExecution Strategy Simplification: Renamed execution modes from
:sync/:oban/:distributedto:local/:distributedfor clearer API semanticsComprehensive Documentation: Added API reference guide, updated README and getting started guide, created documentation index, and clarified library positioning
Version Update: Bumped version to 0.1.5 with corresponding changelog entries
Development Environment: Updated database naming from
quantum_flowtosingularity_workflowthroughout configuration filesCleanup: Removed obsolete migrations, tests, and documentation files related to schema renaming and old architecture
Diagram Walkthrough
File Walkthrough
9 files
executor.ex
Workflow lifecycle management functions for production operationslib/singularity_workflow/executor.ex
cancel_workflow_run/3to cancel running workflows with customreasons and force options
list_workflow_runs/2to query workflows with filtering,pagination, and ordering
retry_failed_workflow/3to retry failed workflows with optionalstep skipping
pause_workflow_run/2andresume_workflow_run/2for softpause/resume functionality
cancel_oban_jobs_for_run/2helper for distributed jobcancellation
lineage.ex
Lineage tracking module for evolutionary learning systemslib/singularity_workflow/lineage.ex
get_lineage/2to retrieve complete execution history withtask graphs and metrics
replay/3for deterministic workflow reproductionget_lineages/2andquery_lineages/2for batch lineagequeries with filtering
trace building
distributed_backend.ex
Distributed backend implementation using PostgreSQL pgmqlib/singularity_workflow/execution/backends/distributed_backend.ex
ObanBackendinternally for PostgreSQL + pgmq-basedexecution
exposed to users
execute/4for distributed task execution with resourceallocation
available?/0to check if Oban is loadedsingularity_workflow.ex
Public API delegation and documentation updateslib/singularity_workflow.ex
code examples
replaces NATS
defdelegatecalls for lifecycle functions:cancel_workflow_run,list_workflow_runs,retry_failed_workflow,pause_workflow_run,resume_workflow_run,get_run_statusstrategy.ex
Execution strategy refactoring with cleaner APIlib/singularity_workflow/execution/strategy.ex
:sync/:oban/:distributedto:local/:distributeddetail
execute/4to only support:localand:distributedmodesavailable?/1to checkDistributedBackend.available?()insteadof hardcoded false
workflow_definition.ex
Execution mode naming consistency updateslib/singularity_workflow/dag/workflow_definition.ex
:syncto:localthroughoutthe module
:local | :distributedinstead of:sync |:oban | :distributeddefaults
workflow_run.ex
Multi-tenancy field addition to workflow runslib/singularity_workflow/workflow_run.ex
tenant_idfield (binary_id, nullable) toWorkflowRunschematenant_id: Ecto.UUID.t() | niltenant_idto changeset cast list for multi-tenancy supportstep_task.ex
Multi-tenancy field addition to step taskslib/singularity_workflow/step_task.ex
tenant_idfield (binary_id) toStepTaskschematenant_id: Ecto.UUID.t() | niltenant_idto changeset cast list for multi-tenancy supportstep_state.ex
Multi-tenancy field addition to step stateslib/singularity_workflow/step_state.ex
tenant_idfield (binary_id) toStepStateschematenant_id: Ecto.UUID.t() | niltenant_idto changeset cast list for multi-tenancy support3 files
20251109000000_add_tenant_id_to_all_tables.exs
Multi-tenancy support via tenant_id fields and indexespriv/repo/migrations/20251109000000_add_tenant_id_to_all_tables.exs
tenant_idUUID field toworkflow_runs,workflow_step_states, andworkflow_step_taskstenant_idfor query performance and compositeindexes for common queries
multi-tenancy enforcement
mix.exs
Version number correctionmix.exs
version
flake.nix
Development environment database naming updatesflake.nix
quantum_flowtosingularity_workflowthroughout
correct database name
8 files
notifications.ex
Documentation updates for messaging infrastructure claritylib/singularity_workflow/notifications.ex
replacement
documentation
Evo.txt
Evolutionary learning package specification documentEvo.txt
singularity_evolutionpackage(separate from core library)
patterns
hot-reload
lineage API
guidance
API_REFERENCE.md
Complete API reference documentation with examplesdocs/API_REFERENCE.md
orchestration
guidance
README.md
README updates for library positioning and featuresREADME.md
GETTING_STARTED.md
Getting started guide updates for library usageGETTING_STARTED.md
__workflow_steps__pattern
README.md
Documentation index and navigation guidedocs/README.md
features, community)
SECURITY.md
Security documentation cleanupSECURITY.md
SECURITY_AUDIT.mdfileCHANGELOG.md
Release notes for workflow lifecycle management featuresCHANGELOG.md
management features
cancel_workflow_run/3,list_workflow_runs/2,retry_failed_workflow/3,pause_workflow_run/2,and
resume_workflow_run/2existing guides
SINGULARITY_WORKFLOW_REFERENCE.mdtoAPI_REFERENCE.md1 files
singularity_workflow_doctest.exs
Doctest infrastructure for documentation examplestest/singularity_workflow_doctest.exs
1 files
.envrc
Development environment comment update.envrc
quantum_flowtosingularity-workflowsfor clarity12 files