feat: Automated Pipelines Framework (Feature 009)#28
Conversation
Entire-Checkpoint: fe44facc22b0
Entire-Checkpoint: eb89c20cf1b5
Entire-Checkpoint: 1eac9845c9b4
Entire-Checkpoint: 1eac9845c9b4
Feature 008 (Profile Isolation and Scale): spec, plan, research, data-model, tasks.md, and 8 work packages covering tenant-scoped profile versioning, composite inheritance, corpus intake, and caching. Feature 009 (Automated Pipelines Framework): spec, plan, research, data-model, tasks.md, and 10 work packages covering event bus, trigger system, pipeline executor, review gates, and analytics. Both features pass Constitution v1.6 (13/13 principles). Feature 008 targets 17-24d across 41 subtasks; Feature 009 targets 22 work items across 60 subtasks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 8 tables in `pipelines` pgSchema: pipelines, pipeline_steps, pipeline_executions, execution_steps, trigger_events, review_decisions, pipeline_templates, pipeline_metrics - 8 enums: pipeline_status, execution_status, execution_step_status, trigger_event_type, trigger_event_status, step_type, concurrency_policy, review_decision_status - All relations, indexes, and FK cascades per data-model.md - Shared TypeScript types and constants (types.ts) - Zod validation schemas for all pipeline inputs (validation.ts) - Module barrel export (index.ts) - DB client updated to merge pipelines schema - Drizzle config updated to include content + pipelines schemas - Migration generated (0001_silent_miek.sql) Typecheck passes, 110/110 existing tests pass, zero regressions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s, FK cascades - Add tenant_id (nullable) to pipeline_templates for multi-tenant isolation - Add quality_signals table with partial index on unacknowledged signals - Add partial index on trigger_events WHERE processed_at IS NULL (poll hot path) - Fix FK cascades: triggerEventId, stepId, executionStepId (cascade), templateId (set null) - Use CREATE SCHEMA IF NOT EXISTS in migration for idempotent deploys - Regenerate migration as clean delta Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: b8bcee001292
Required by spec-kitty implement command for worktree creation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 84f4c3b94df0
Entire-Checkpoint: 84f4c3b94df0
Entire-Checkpoint: 84f4c3b94df0
Entire-Checkpoint: 54b63ce525cb
Entire-Checkpoint: 54b63ce525cb
Feature 008 (Profile Isolation and Scale): spec, plan, research, data-model, tasks.md, and 8 work packages covering tenant-scoped profile versioning, composite inheritance, corpus intake, and caching. Feature 009 (Automated Pipelines Framework): spec, plan, research, data-model, tasks.md, and 10 work packages covering event bus, trigger system, pipeline executor, review gates, and analytics. Both features pass Constitution v1.6 (13/13 principles). Feature 008 targets 17-24d across 41 subtasks; Feature 009 targets 22 work items across 60 subtasks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 8 tables in `pipelines` pgSchema: pipelines, pipeline_steps, pipeline_executions, execution_steps, trigger_events, review_decisions, pipeline_templates, pipeline_metrics - 8 enums: pipeline_status, execution_status, execution_step_status, trigger_event_type, trigger_event_status, step_type, concurrency_policy, review_decision_status - All relations, indexes, and FK cascades per data-model.md - Shared TypeScript types and constants (types.ts) - Zod validation schemas for all pipeline inputs (validation.ts) - Module barrel export (index.ts) - DB client updated to merge pipelines schema - Drizzle config updated to include content + pipelines schemas - Migration generated (0001_silent_miek.sql) Typecheck passes, 110/110 existing tests pass, zero regressions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s, FK cascades - Add tenant_id (nullable) to pipeline_templates for multi-tenant isolation - Add quality_signals table with partial index on unacknowledged signals - Add partial index on trigger_events WHERE processed_at IS NULL (poll hot path) - Fix FK cascades: triggerEventId, stepId, executionStepId (cascade), templateId (set null) - Use CREATE SCHEMA IF NOT EXISTS in migration for idempotent deploys - Regenerate migration as clean delta Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- EventBus interface, EventEnvelope, EventHandler types - PgNotifyBus: PostgreSQL LISTEN/NOTIFY with trigger_events queue table - InMemoryEventBus: synchronous in-process bus for testing - Factory function with environment-based selection - 6 unit tests passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- handleNotification now transitions events to processed/failed after dispatch - Atomic claim with status=pending guard prevents duplicate processing - InMemoryEventBus now uses try/catch per handler matching PgNotifyBus behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 54b63ce525cb
Feature 008 (Profile Isolation and Scale): spec, plan, research, data-model, tasks.md, and 8 work packages covering tenant-scoped profile versioning, composite inheritance, corpus intake, and caching. Feature 009 (Automated Pipelines Framework): spec, plan, research, data-model, tasks.md, and 10 work packages covering event bus, trigger system, pipeline executor, review gates, and analytics. Both features pass Constitution v1.6 (13/13 principles). Feature 008 targets 17-24d across 41 subtasks; Feature 009 targets 22 work items across 60 subtasks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 8 tables in `pipelines` pgSchema: pipelines, pipeline_steps, pipeline_executions, execution_steps, trigger_events, review_decisions, pipeline_templates, pipeline_metrics - 8 enums: pipeline_status, execution_status, execution_step_status, trigger_event_type, trigger_event_status, step_type, concurrency_policy, review_decision_status - All relations, indexes, and FK cascades per data-model.md - Shared TypeScript types and constants (types.ts) - Zod validation schemas for all pipeline inputs (validation.ts) - Module barrel export (index.ts) - DB client updated to merge pipelines schema - Drizzle config updated to include content + pipelines schemas - Migration generated (0001_silent_miek.sql) Typecheck passes, 110/110 existing tests pass, zero regressions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s, FK cascades - Add tenant_id (nullable) to pipeline_templates for multi-tenant isolation - Add quality_signals table with partial index on unacknowledged signals - Add partial index on trigger_events WHERE processed_at IS NULL (poll hot path) - Fix FK cascades: triggerEventId, stepId, executionStepId (cascade), templateId (set null) - Use CREATE SCHEMA IF NOT EXISTS in migration for idempotent deploys - Regenerate migration as clean delta Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- TriggerHandler interface, TriggerContext, TriggerResult types - CorpusChangeTriggerHandler with source filtering and depth guard - ManualRequestTriggerHandler with pipeline ID targeting - TriggerRegistry with default handlers pre-registered - DFS cycle detector with dependency graph builder - 30 unit tests passing (10 graph, 10 corpus-change, 10 manual-request) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 54b63ce525cb
9 tables, 8 enums in pipelines PostgreSQL schema. Drizzle ORM with tenant isolation, quality signals, partial indexes, FK cascades. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> # Conflicts: # kitty-specs/008-profile-isolation-and-scale/meta.json # kitty-specs/009-automated-pipelines-framework/meta.json # kitty-specs/009-automated-pipelines-framework/tasks/WP01-schema-foundation.md # kitty-specs/009-automated-pipelines-framework/tasks/WP02-event-bus.md # kitty-specs/009-automated-pipelines-framework/tasks/WP03-trigger-system.md
EventBus interface, PgNotifyBus (LISTEN/NOTIFY + trigger_events queue), InMemoryEventBus for testing, factory function. Atomic event claiming, processed/failed lifecycle transitions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> # Conflicts: # kitty-specs/009-automated-pipelines-framework/tasks/WP02-event-bus.md # kitty-specs/009-automated-pipelines-framework/tasks/WP03-trigger-system.md
TriggerHandler interface, CorpusChangeTriggerHandler, ManualRequestTriggerHandler, TriggerRegistry, DFS cycle detector with dependency graph builder. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> # Conflicts: # kitty-specs/009-automated-pipelines-framework/tasks/WP03-trigger-system.md
5 integration test suites: e2e execution (5 tests), review gate flow (10), scheduled execution (6), analytics accuracy (13), tenant isolation (8). 315 total tests, 0 regressions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
MetricsAggregator: counts, p95 duration, failure breakdown, review rates, 90-day refresh. QualitySignalEmitter: rejection rate monitoring with per-pipeline cooldown. 17 new tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 integration suites: e2e execution, review gate flow, scheduled execution, analytics accuracy, tenant isolation. 42 new tests, 315 total. Feature 009 complete. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Code Review — Request ChangesRan a detailed review of the pipeline framework. Typecheck and tests pass (31 files, 332 tests), but there are significant integration/control-flow issues that the test suite mocks around rather than exercising end-to-end. High Severity1. Pipeline REST API exposed without auth; tenant identity is client-controlled
2. Scheduled pipelines are never wired into the runtime
3. Review-gate executions have no resume path
Medium Severity4. Trigger events are double-recorded with mismatched IDs
5. Update validation is weaker than create validation
Broader RecommendationBeyond these findings, we evaluated whether the ~5,000 LOC custom pipeline engine should be replaced by Inngest (open-source durable workflow platform for TypeScript). Roughly 3,000 lines of execution plumbing (event bus, executor, retry/backoff, cron scheduling, idempotency, step runner) map directly to Inngest built-in features, while ~2,000 lines of domain logic (step handlers, review decisions, templates, quality signals, cycle detection) would be retained. Notably, findings #2, #3, and #4 are all bugs in the custom execution plumbing that wouldn't exist if durable execution, cron scheduling, and human-in-the-loop pause/resume were handled by a maintained library. Created #29 to spike Inngest as the execution layer. Recommendation: request changes before merge. |
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
Entire-Checkpoint: e59ad95c5361
- 009 meta.json: add measurement_owner, review_cadence, risk_class, lifecycle_state - 009 checklists/requirements.md: create requirements checklist artifact - 005 tasks/: create 14 stub WP files (implementation in private joyus-profile-engine) - 007 WP03: escape example path refs to prevent false-positive broken-link detection - secret-scan.yml: switch from gitleaks-action@v2 (requires org license) to gitleaks binary Entire-Checkpoint: 16dc631d3396
Entire-Checkpoint: 16dc631d3396
- Bug 1: add requireBearerToken middleware to pipeline router mount; getTenantId() now reads req.mcpUser.id instead of trusting x-tenant-id header - Bug 2: instantiate ScheduleTriggerHandler in init.ts, register in trigger registry, call loadAllSchedules() on startup, stopAll() on shutdown - Bug 3: add PipelineExecutor.resumeFromGate(); DecisionRecorder calls it after setting execution back to running — approved gates now resume - Bug 4: executor reuses event ID from bus insert instead of creating a second trigger_events row - Bug 5: extract validateSteps() shared helper; PUT handler now validates step configs with same rigor as POST Entire-Checkpoint: 631838901f66
|
Closing as superseded. Feature 009 (Automated Pipelines Framework) is fully implemented — all 10 WPs were merged directly to main via the spec-kitty workflow. This PR branch contains only housekeeping/acceptance commits after the fact. |
Pipeline routes were mounted without requireBearerToken, exposing all CRUD/execution endpoints to unauthenticated callers. getTenantId() trusted the x-tenant-id header, allowing any caller to impersonate any tenant. - Add requireBearerToken middleware to pipeline route mount (index.ts) - Replace header-based tenant resolution with auth-derived identity (mcpUser.id from Bearer token, matching tools/executor.ts pattern) - Update route tests to use mcpUser instead of x-tenant-id header Ref: PR #28 review findings 1a/1b (grndlvl), issue #37 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Closes #27
What changed
New modules in
joyus-ai-mcp-server/src/pipelines/pipelinesPostgreSQL schema (Drizzle ORM)New tools in
src/tools/Modified files
src/tools/index.ts-- registered pipeline toolssrc/tools/executor.ts-- added pipeline tool dispatchsrc/index.ts-- pipeline module initialization and route mountsrc/db/client.ts-- added pipelines schema to Drizzle clientTest plan
Generated with Claude Code