@exaudeus/workrail 3.27.0 → 3.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/console/assets/{index-FtTaDku8.js → index-BZ6HkxGf.js} +1 -1
- package/dist/console/index.html +1 -1
- package/dist/manifest.json +3 -3
- package/docs/README.md +57 -0
- package/docs/adrs/001-hybrid-storage-backend.md +38 -0
- package/docs/adrs/002-four-layer-context-classification.md +38 -0
- package/docs/adrs/003-checkpoint-trigger-strategy.md +35 -0
- package/docs/adrs/004-opt-in-encryption-strategy.md +36 -0
- package/docs/adrs/005-agent-first-workflow-execution-tokens.md +105 -0
- package/docs/adrs/006-append-only-session-run-event-log.md +76 -0
- package/docs/adrs/007-resume-and-checkpoint-only-sessions.md +51 -0
- package/docs/adrs/008-blocked-nodes-architectural-upgrade.md +178 -0
- package/docs/adrs/009-bridge-mode-single-instance-mcp.md +195 -0
- package/docs/adrs/010-release-pipeline.md +89 -0
- package/docs/architecture/README.md +7 -0
- package/docs/architecture/refactor-audit.md +364 -0
- package/docs/authoring-v2.md +527 -0
- package/docs/authoring.md +873 -0
- package/docs/changelog-recent.md +201 -0
- package/docs/configuration.md +505 -0
- package/docs/ctc-mcp-proposal.md +518 -0
- package/docs/design/README.md +22 -0
- package/docs/design/agent-cascade-protocol.md +96 -0
- package/docs/design/autonomous-console-design-candidates.md +253 -0
- package/docs/design/autonomous-console-design-review.md +111 -0
- package/docs/design/autonomous-platform-mvp-discovery.md +525 -0
- package/docs/design/claude-code-source-deep-dive.md +713 -0
- package/docs/design/console-cyberpunk-ui-discovery.md +504 -0
- package/docs/design/console-execution-trace-candidates-final.md +160 -0
- package/docs/design/console-execution-trace-candidates.md +211 -0
- package/docs/design/console-execution-trace-design-candidates-v2.md +113 -0
- package/docs/design/console-execution-trace-design-review.md +74 -0
- package/docs/design/console-execution-trace-discovery.md +394 -0
- package/docs/design/console-execution-trace-final-review.md +77 -0
- package/docs/design/console-execution-trace-review.md +92 -0
- package/docs/design/console-performance-discovery.md +415 -0
- package/docs/design/console-ui-backlog.md +280 -0
- package/docs/design/daemon-architecture-discovery.md +853 -0
- package/docs/design/daemon-design-candidates.md +318 -0
- package/docs/design/daemon-design-review-findings.md +119 -0
- package/docs/design/daemon-engine-design-candidates.md +210 -0
- package/docs/design/daemon-engine-design-review.md +131 -0
- package/docs/design/daemon-execution-engine-discovery.md +280 -0
- package/docs/design/daemon-gap-analysis.md +554 -0
- package/docs/design/daemon-owns-console-plan.md +168 -0
- package/docs/design/daemon-owns-console-review.md +91 -0
- package/docs/design/daemon-owns-console.md +195 -0
- package/docs/design/data-model-erd.md +11 -0
- package/docs/design/design-candidates-consolidate-dev-staleness.md +98 -0
- package/docs/design/design-candidates-walk-cache-depth-limit.md +80 -0
- package/docs/design/design-review-consolidate-dev-staleness.md +54 -0
- package/docs/design/design-review-walk-cache-depth-limit.md +48 -0
- package/docs/design/implementation-plan-consolidate-dev-staleness.md +142 -0
- package/docs/design/implementation-plan-walk-cache-depth-limit.md +141 -0
- package/docs/design/layer3b-ghost-nodes-design-candidates.md +229 -0
- package/docs/design/layer3b-ghost-nodes-design-review.md +93 -0
- package/docs/design/layer3b-ghost-nodes-implementation-plan.md +219 -0
- package/docs/design/list-workflows-latency-fix-plan.md +128 -0
- package/docs/design/list-workflows-latency-fix-review.md +55 -0
- package/docs/design/list-workflows-latency-fix.md +109 -0
- package/docs/design/native-context-management-api.md +11 -0
- package/docs/design/performance-sweep-2026-04.md +96 -0
- package/docs/design/routines-guide.md +219 -0
- package/docs/design/sequence-diagrams.md +11 -0
- package/docs/design/subagent-design-principles.md +220 -0
- package/docs/design/temporal-patterns-design-candidates.md +312 -0
- package/docs/design/temporal-patterns-design-review-findings.md +163 -0
- package/docs/design/test-isolation-from-config-file.md +335 -0
- package/docs/design/v2-core-design-locks.md +2746 -0
- package/docs/design/v2-lock-registry.json +734 -0
- package/docs/design/workflow-authoring-v2.md +1044 -0
- package/docs/design/workflow-docs-spec.md +218 -0
- package/docs/design/workflow-extension-points.md +687 -0
- package/docs/design/workrail-auto-trigger-system.md +359 -0
- package/docs/design/workrail-config-file-discovery.md +513 -0
- package/docs/docker.md +110 -0
- package/docs/generated/v2-lock-closure-plan.md +26 -0
- package/docs/generated/v2-lock-coverage.json +797 -0
- package/docs/generated/v2-lock-coverage.md +177 -0
- package/docs/ideas/backlog.md +3927 -0
- package/docs/ideas/design-candidates-mcp-resilience.md +208 -0
- package/docs/ideas/design-review-findings-mcp-resilience.md +119 -0
- package/docs/ideas/implementation_plan.md +249 -0
- package/docs/ideas/third-party-workflow-setup-design-thinking.md +1948 -0
- package/docs/implementation/02-architecture.md +316 -0
- package/docs/implementation/04-testing-strategy.md +124 -0
- package/docs/implementation/09-simple-workflow-guide.md +835 -0
- package/docs/implementation/13-advanced-validation-guide.md +874 -0
- package/docs/implementation/README.md +21 -0
- package/docs/integrations/claude-code.md +300 -0
- package/docs/integrations/firebender.md +315 -0
- package/docs/migration/v0.1.0.md +147 -0
- package/docs/naming-conventions.md +45 -0
- package/docs/planning/README.md +104 -0
- package/docs/planning/github-ticketing-playbook.md +195 -0
- package/docs/plans/README.md +24 -0
- package/docs/plans/agent-managed-ticketing-design.md +605 -0
- package/docs/plans/agentic-orchestration-roadmap.md +112 -0
- package/docs/plans/assessment-gates-engine-handoff.md +536 -0
- package/docs/plans/content-coherence-and-references.md +151 -0
- package/docs/plans/library-extraction-plan.md +340 -0
- package/docs/plans/mr-review-workflow-redesign.md +1451 -0
- package/docs/plans/native-context-management-epic.md +11 -0
- package/docs/plans/perf-fixes-design-candidates.md +225 -0
- package/docs/plans/perf-fixes-design-review-findings.md +61 -0
- package/docs/plans/perf-fixes-new-issues-candidates.md +264 -0
- package/docs/plans/perf-fixes-new-issues-review.md +110 -0
- package/docs/plans/prompt-fragments.md +53 -0
- package/docs/plans/ui-ux-workflow-design-candidates.md +120 -0
- package/docs/plans/ui-ux-workflow-discovery.md +100 -0
- package/docs/plans/ui-ux-workflow-review.md +48 -0
- package/docs/plans/v2-followup-enhancements.md +587 -0
- package/docs/plans/workflow-categories-candidates.md +105 -0
- package/docs/plans/workflow-categories-discovery.md +110 -0
- package/docs/plans/workflow-categories-review.md +51 -0
- package/docs/plans/workflow-discovery-model-candidates.md +94 -0
- package/docs/plans/workflow-discovery-model-discovery.md +74 -0
- package/docs/plans/workflow-discovery-model-review.md +48 -0
- package/docs/plans/workflow-source-setup-phase-1.md +245 -0
- package/docs/plans/workflow-source-setup-phase-2.md +361 -0
- package/docs/plans/workflow-staleness-detection-candidates.md +104 -0
- package/docs/plans/workflow-staleness-detection-review.md +58 -0
- package/docs/plans/workflow-staleness-detection.md +80 -0
- package/docs/plans/workflow-v2-design.md +69 -0
- package/docs/plans/workflow-v2-roadmap.md +74 -0
- package/docs/plans/workflow-validation-design.md +98 -0
- package/docs/plans/workflow-validation-roadmap.md +108 -0
- package/docs/plans/workrail-platform-vision.md +420 -0
- package/docs/reference/agent-context-cleaner-snippet.md +94 -0
- package/docs/reference/agent-context-guidance.md +140 -0
- package/docs/reference/context-optimization.md +284 -0
- package/docs/reference/example-workflow-repository-template/.github/workflows/validate.yml +125 -0
- package/docs/reference/example-workflow-repository-template/README.md +268 -0
- package/docs/reference/example-workflow-repository-template/workflows/example-workflow.json +80 -0
- package/docs/reference/external-workflow-repositories.md +916 -0
- package/docs/reference/feature-flags-architecture.md +472 -0
- package/docs/reference/feature-flags.md +349 -0
- package/docs/reference/god-tier-workflow-validation.md +272 -0
- package/docs/reference/loop-optimization.md +209 -0
- package/docs/reference/loop-validation.md +176 -0
- package/docs/reference/loops.md +465 -0
- package/docs/reference/mcp-platform-constraints.md +59 -0
- package/docs/reference/recovery.md +88 -0
- package/docs/reference/releases.md +177 -0
- package/docs/reference/troubleshooting.md +105 -0
- package/docs/reference/workflow-execution-contract.md +998 -0
- package/docs/roadmap/README.md +22 -0
- package/docs/roadmap/legacy-planning-status.md +103 -0
- package/docs/roadmap/now-next-later.md +70 -0
- package/docs/roadmap/open-work-inventory.md +389 -0
- package/docs/tickets/README.md +39 -0
- package/docs/tickets/next-up.md +76 -0
- package/docs/workflow-management.md +317 -0
- package/docs/workflow-templates.md +423 -0
- package/docs/workflow-validation.md +184 -0
- package/docs/workflows.md +254 -0
- package/package.json +3 -1
- package/spec/authoring-spec.json +61 -16
- package/workflows/workflow-for-workflows.json +252 -93
- package/workflows/workflow-for-workflows.v2.json +188 -77
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# Feature Flags System
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
WorkRail uses a **feature flag system** to enable trunk-based development and safe, incremental releases. Features can be merged to `main` with flags **OFF by default**, tested in production environments, and enabled when stable.
|
|
6
|
+
|
|
7
|
+
## Philosophy
|
|
8
|
+
|
|
9
|
+
### Trunk-Based Development
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
main (always releasable)
|
|
13
|
+
↑
|
|
14
|
+
└─ feature/session-tools (merged after 1 day, flag=off)
|
|
15
|
+
└─ feature/new-workflow (merged after 2 days, flag=off)
|
|
16
|
+
└─ fix/bug-123 (merged immediately, no flag needed)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Benefits:**
|
|
20
|
+
- No long-lived branches
|
|
21
|
+
- No merge conflicts
|
|
22
|
+
- Continuous integration
|
|
23
|
+
- Fast feedback loops
|
|
24
|
+
- Safe releases (experimental features hidden)
|
|
25
|
+
|
|
26
|
+
### Clean Architecture
|
|
27
|
+
|
|
28
|
+
The feature flag system follows SOLID principles:
|
|
29
|
+
|
|
30
|
+
- **Single Responsibility**: Only manages feature configuration
|
|
31
|
+
- **Open/Closed**: Add new flags without modifying existing code
|
|
32
|
+
- **Liskov Substitution**: Different providers are interchangeable
|
|
33
|
+
- **Interface Segregation**: Focused, minimal interface
|
|
34
|
+
- **Dependency Injection**: Testable, no global state
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
### For Users
|
|
39
|
+
|
|
40
|
+
#### Enable a Feature via Environment Variable
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Enable session management tools
|
|
44
|
+
export WORKRAIL_ENABLE_SESSION_TOOLS=true
|
|
45
|
+
|
|
46
|
+
# Enable experimental workflows
|
|
47
|
+
export WORKRAIL_ENABLE_EXPERIMENTAL_WORKFLOWS=true
|
|
48
|
+
|
|
49
|
+
# Enable verbose logging
|
|
50
|
+
export WORKRAIL_VERBOSE_LOGGING=true
|
|
51
|
+
|
|
52
|
+
# Start MCP server
|
|
53
|
+
node dist/mcp-server.js
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Check Available Features
|
|
57
|
+
|
|
58
|
+
When the MCP server starts, it logs enabled features:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
[FeatureFlags] Session tools disabled (enable with WORKRAIL_ENABLE_SESSION_TOOLS=true)
|
|
62
|
+
[FeatureFlags] Experimental features enabled: experimentalWorkflows
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Accepted Boolean Values
|
|
66
|
+
|
|
67
|
+
The following values are recognized as `true`:
|
|
68
|
+
- `true`, `TRUE`
|
|
69
|
+
- `1`
|
|
70
|
+
- `yes`, `YES`
|
|
71
|
+
- `on`, `ON`
|
|
72
|
+
|
|
73
|
+
The following values are recognized as `false`:
|
|
74
|
+
- `false`, `FALSE`
|
|
75
|
+
- `0`
|
|
76
|
+
- `no`, `NO`
|
|
77
|
+
- `off`, `OFF`
|
|
78
|
+
- (undefined/not set)
|
|
79
|
+
|
|
80
|
+
### For Developers
|
|
81
|
+
|
|
82
|
+
#### Check if a Feature is Enabled
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { IFeatureFlagProvider } from './config/feature-flags.js';
|
|
86
|
+
|
|
87
|
+
class MyService {
|
|
88
|
+
constructor(private featureFlags: IFeatureFlagProvider) {}
|
|
89
|
+
|
|
90
|
+
async doSomething() {
|
|
91
|
+
if (this.featureFlags.isEnabled('sessionTools')) {
|
|
92
|
+
// Session tools enabled - use them
|
|
93
|
+
await this.useSessionTools();
|
|
94
|
+
} else {
|
|
95
|
+
// Session tools disabled - use alternative
|
|
96
|
+
await this.useAlternative();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### Add a New Feature Flag
|
|
103
|
+
|
|
104
|
+
1. Add to `FEATURE_FLAG_DEFINITIONS` in `src/config/feature-flags.ts`:
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
export const FEATURE_FLAG_DEFINITIONS: ReadonlyArray<FeatureFlagDefinition> = [
|
|
108
|
+
// ... existing flags ...
|
|
109
|
+
{
|
|
110
|
+
key: 'myNewFeature',
|
|
111
|
+
envVar: 'WORKRAIL_ENABLE_MY_NEW_FEATURE',
|
|
112
|
+
defaultValue: false, // OFF by default for experimental features
|
|
113
|
+
description: 'Enable my new experimental feature',
|
|
114
|
+
since: '0.7.0',
|
|
115
|
+
stable: false, // Mark true when production-ready
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
2. TypeScript automatically provides type safety - no additional changes needed!
|
|
121
|
+
|
|
122
|
+
3. Use in your code:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
if (featureFlags.isEnabled('myNewFeature')) {
|
|
126
|
+
// Feature code here
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### Testing with Feature Flags
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { createAppContainer } from './container.js';
|
|
134
|
+
import { StaticFeatureFlagProvider } from './config/feature-flags.js';
|
|
135
|
+
|
|
136
|
+
describe('MyFeature', () => {
|
|
137
|
+
it('works when feature is enabled', () => {
|
|
138
|
+
// Inject test-specific feature flags
|
|
139
|
+
const container = createAppContainer({
|
|
140
|
+
featureFlags: new StaticFeatureFlagProvider({
|
|
141
|
+
myNewFeature: true,
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Test with feature enabled
|
|
146
|
+
expect(container.featureFlags.isEnabled('myNewFeature')).toBe(true);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('uses fallback when feature is disabled', () => {
|
|
150
|
+
const container = createAppContainer({
|
|
151
|
+
featureFlags: new StaticFeatureFlagProvider({
|
|
152
|
+
myNewFeature: false,
|
|
153
|
+
}),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// Test with feature disabled
|
|
157
|
+
expect(container.featureFlags.isEnabled('myNewFeature')).toBe(false);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Available Feature Flags
|
|
163
|
+
|
|
164
|
+
### `sessionTools`
|
|
165
|
+
|
|
166
|
+
**Environment Variable:** `WORKRAIL_ENABLE_SESSION_TOOLS`
|
|
167
|
+
**Default:** `false` (experimental)
|
|
168
|
+
**Since:** `0.6.0`
|
|
169
|
+
|
|
170
|
+
Enables session management tools:
|
|
171
|
+
- `workrail_create_session`
|
|
172
|
+
- `workrail_update_session`
|
|
173
|
+
- `workrail_read_session`
|
|
174
|
+
- `workrail_open_dashboard`
|
|
175
|
+
|
|
176
|
+
Also starts the HTTP dashboard server.
|
|
177
|
+
|
|
178
|
+
### `experimentalWorkflows`
|
|
179
|
+
|
|
180
|
+
**Environment Variable:** `WORKRAIL_ENABLE_EXPERIMENTAL_WORKFLOWS`
|
|
181
|
+
**Default:** `false` (experimental)
|
|
182
|
+
**Since:** `0.6.1`
|
|
183
|
+
|
|
184
|
+
Loads workflows from the `workflows/experimental/` directory in addition to stable workflows.
|
|
185
|
+
|
|
186
|
+
### `verboseLogging`
|
|
187
|
+
|
|
188
|
+
**Environment Variable:** `WORKRAIL_VERBOSE_LOGGING`
|
|
189
|
+
**Default:** `false` (stable)
|
|
190
|
+
**Since:** `0.6.0`
|
|
191
|
+
|
|
192
|
+
Enables detailed debug logging throughout the application.
|
|
193
|
+
|
|
194
|
+
## Release Workflow
|
|
195
|
+
|
|
196
|
+
### Phase 1: Development (Feature Flag OFF)
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# 1. Develop feature in short-lived branch
|
|
200
|
+
git checkout -b feature/my-feature
|
|
201
|
+
|
|
202
|
+
# 2. Add feature flag to code
|
|
203
|
+
# 3. Implement feature behind flag
|
|
204
|
+
# 4. Add tests
|
|
205
|
+
# 5. Merge to main (flag OFF by default)
|
|
206
|
+
git checkout main
|
|
207
|
+
git merge feature/my-feature
|
|
208
|
+
|
|
209
|
+
# Feature is in production code but disabled
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Phase 2: Testing (Feature Flag ON for specific users)
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Test in staging/dev environment
|
|
216
|
+
export WORKRAIL_ENABLE_MY_FEATURE=true
|
|
217
|
+
node dist/mcp-server.js
|
|
218
|
+
|
|
219
|
+
# Power users can opt-in to test
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Phase 3: Stabilization (Ready for Release)
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
// Change default from false to true in feature-flags.ts
|
|
226
|
+
{
|
|
227
|
+
key: 'myFeature',
|
|
228
|
+
defaultValue: true, // ← Changed from false to true
|
|
229
|
+
stable: true, // ← Mark as stable
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Phase 4: Cleanup (Remove Flag)
|
|
234
|
+
|
|
235
|
+
After feature is stable for several releases:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
// Remove feature flag check
|
|
239
|
+
// Before:
|
|
240
|
+
if (featureFlags.isEnabled('myFeature')) {
|
|
241
|
+
doNewThing();
|
|
242
|
+
} else {
|
|
243
|
+
doOldThing();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// After:
|
|
247
|
+
doNewThing(); // Feature is now default, remove flag
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Architecture
|
|
251
|
+
|
|
252
|
+
### Component Diagram
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
┌─────────────────────────────────────┐
|
|
256
|
+
│ Environment Variables │
|
|
257
|
+
│ (WORKRAIL_ENABLE_SESSION_TOOLS) │
|
|
258
|
+
└──────────────┬──────────────────────┘
|
|
259
|
+
│
|
|
260
|
+
▼
|
|
261
|
+
┌─────────────────────────────────────┐
|
|
262
|
+
│ EnvironmentFeatureFlagProvider │
|
|
263
|
+
│ (reads env, parses booleans) │
|
|
264
|
+
└──────────────┬──────────────────────┘
|
|
265
|
+
│
|
|
266
|
+
│ implements
|
|
267
|
+
▼
|
|
268
|
+
┌─────────────────────────────────────┐
|
|
269
|
+
│ IFeatureFlagProvider (interface) │
|
|
270
|
+
│ - isEnabled(key) │
|
|
271
|
+
│ - getAll() │
|
|
272
|
+
│ - getSummary() │
|
|
273
|
+
└──────────────┬──────────────────────┘
|
|
274
|
+
│
|
|
275
|
+
│ injected into
|
|
276
|
+
▼
|
|
277
|
+
┌─────────────────────────────────────┐
|
|
278
|
+
│ Application Container │
|
|
279
|
+
│ (Dependency Injection) │
|
|
280
|
+
└──────────────┬──────────────────────┘
|
|
281
|
+
│
|
|
282
|
+
│ provides to
|
|
283
|
+
▼
|
|
284
|
+
┌─────────────────────────────────────┐
|
|
285
|
+
│ Services (MCP Server, etc.) │
|
|
286
|
+
│ (check flags at runtime) │
|
|
287
|
+
└─────────────────────────────────────┘
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Key Design Decisions
|
|
291
|
+
|
|
292
|
+
1. **Immutability**: Flags are read once at startup (MCP restarts are fast)
|
|
293
|
+
2. **Type Safety**: TypeScript provides autocomplete and compile-time checking
|
|
294
|
+
3. **No Dynamic Toggling**: Not needed for MCP (unlike web apps with persistent connections)
|
|
295
|
+
4. **Dependency Injection**: Easy testing, no global state
|
|
296
|
+
5. **Interface-Based**: Easy to add new providers (remote config, database, etc.)
|
|
297
|
+
|
|
298
|
+
## FAQ
|
|
299
|
+
|
|
300
|
+
### Why not use a library (LaunchDarkly, Unleash, etc.)?
|
|
301
|
+
|
|
302
|
+
Feature flag SaaS products are designed for:
|
|
303
|
+
- Dynamic toggling without restarts
|
|
304
|
+
- A/B testing across millions of users
|
|
305
|
+
- Complex targeting rules
|
|
306
|
+
- Analytics and experimentation
|
|
307
|
+
|
|
308
|
+
WorkRail's needs are simpler:
|
|
309
|
+
- Enable/disable tools in MCP server
|
|
310
|
+
- Config via environment variables
|
|
311
|
+
- Read once at startup
|
|
312
|
+
- ~5 flags total
|
|
313
|
+
|
|
314
|
+
A 30-line in-house solution is simpler, faster, and has zero dependencies.
|
|
315
|
+
|
|
316
|
+
### Can I toggle flags without restarting?
|
|
317
|
+
|
|
318
|
+
No. MCP servers are stateless and restart instantly, so dynamic toggling isn't needed. Just restart the MCP server with new environment variables.
|
|
319
|
+
|
|
320
|
+
### How do I test multiple flag combinations?
|
|
321
|
+
|
|
322
|
+
Use `StaticFeatureFlagProvider` in tests:
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
const container = createAppContainer({
|
|
326
|
+
featureFlags: new StaticFeatureFlagProvider({
|
|
327
|
+
feature1: true,
|
|
328
|
+
feature2: false,
|
|
329
|
+
feature3: true,
|
|
330
|
+
}),
|
|
331
|
+
});
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### When should I remove a feature flag?
|
|
335
|
+
|
|
336
|
+
After the feature has been:
|
|
337
|
+
1. Enabled by default for at least 2 releases
|
|
338
|
+
2. Proven stable in production
|
|
339
|
+
3. No user reports of issues
|
|
340
|
+
4. No need to disable it anymore
|
|
341
|
+
|
|
342
|
+
Then remove the flag and the conditional code.
|
|
343
|
+
|
|
344
|
+
## References
|
|
345
|
+
|
|
346
|
+
- [Trunk-Based Development](https://trunkbaseddevelopment.com/)
|
|
347
|
+
- [Feature Toggles (Martin Fowler)](https://martinfowler.com/articles/feature-toggles.html)
|
|
348
|
+
- [SOLID Principles](https://en.wikipedia.org/wiki/SOLID)
|
|
349
|
+
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
# God-Tier Workflow Validation
|
|
2
|
+
## Purpose
|
|
3
|
+
This document defines the required bar for workflow validation in WorkRail.
|
|
4
|
+
It exists to eliminate a class of trust-destroying failures where a workflow appears valid, is discoverable, is mergeable, or is startable, but later fails because the workflow itself is invalid.
|
|
5
|
+
The core promise is simple:
|
|
6
|
+
**if WorkRail says a workflow is valid and runnable, it must not fail later because of workflow-definition, normalization, discovery, compilation, or execution-contract defects.**
|
|
7
|
+
---
|
|
8
|
+
## Product-Level Non-Negotiables
|
|
9
|
+
### 1. Workflows must never fail during execution because the workflow itself is invalid
|
|
10
|
+
Once a workflow is accepted as runnable:
|
|
11
|
+
- `start_workflow` must not fail because the workflow is invalid
|
|
12
|
+
- `continue_workflow` must not fail because the workflow is invalid
|
|
13
|
+
- no later execution step may rediscover authoring invalidity
|
|
14
|
+
- pinned snapshots must already be trustworthy executable artifacts
|
|
15
|
+
If such a failure occurs, that is a **validation bug**.
|
|
16
|
+
### 2. Invalid workflows must never be mergeable
|
|
17
|
+
If any discoverable workflow is invalid:
|
|
18
|
+
- local validation must fail
|
|
19
|
+
- precommit must fail
|
|
20
|
+
- CI must fail
|
|
21
|
+
- merge must be blocked
|
|
22
|
+
### 3. Invalid workflows must never be hidden
|
|
23
|
+
Invalid workflows must not be:
|
|
24
|
+
- silently skipped
|
|
25
|
+
- omitted from validation output
|
|
26
|
+
- shadowed by another file without an explicit error
|
|
27
|
+
- hidden from registry validation because a different variant passed
|
|
28
|
+
Validation must fail loudly and report the problem.
|
|
29
|
+
### 4. Validation must be runtime-authoritative
|
|
30
|
+
Validation must validate the **same workflow runtime would execute**, not just a nearby file that looks similar.
|
|
31
|
+
---
|
|
32
|
+
## Core Contract
|
|
33
|
+
A workflow is only considered valid if WorkRail can prove all of the following:
|
|
34
|
+
1. it is discoverable without ambiguity
|
|
35
|
+
2. its runtime ID resolves deterministically
|
|
36
|
+
3. the resolved authored definition is schema-valid
|
|
37
|
+
4. the resolved authored definition is structurally valid
|
|
38
|
+
5. it normalizes into executable form successfully
|
|
39
|
+
6. the executable form passes executable schema validation
|
|
40
|
+
7. the executable form compiles successfully
|
|
41
|
+
8. the workflow can be started successfully
|
|
42
|
+
9. the workflow can be advanced successfully
|
|
43
|
+
10. the workflow can be driven to terminal completion in deterministic test execution
|
|
44
|
+
If any of these fail, the workflow is invalid.
|
|
45
|
+
---
|
|
46
|
+
## What Validation Must Be
|
|
47
|
+
### Authoritative
|
|
48
|
+
Validation is the single source of truth for executability.
|
|
49
|
+
There must not be multiple incompatible definitions of “valid” across:
|
|
50
|
+
- JSON schema validation
|
|
51
|
+
- structural validation
|
|
52
|
+
- workflow discovery
|
|
53
|
+
- start-time normalization
|
|
54
|
+
- runtime compilation
|
|
55
|
+
- execution-time transitions
|
|
56
|
+
### Runtime-equivalent
|
|
57
|
+
Validation must exercise the same logical contract as runtime:
|
|
58
|
+
- workflow discovery
|
|
59
|
+
- workflow ID resolution
|
|
60
|
+
- source selection
|
|
61
|
+
- authored-definition checks
|
|
62
|
+
- executable normalization
|
|
63
|
+
- executable schema enforcement
|
|
64
|
+
- compilation
|
|
65
|
+
- startability
|
|
66
|
+
- execution lifecycle
|
|
67
|
+
### Deterministic
|
|
68
|
+
The same repository state must always produce the same validation outcome.
|
|
69
|
+
There must be no:
|
|
70
|
+
- source-order dependence
|
|
71
|
+
- best-effort repair paths
|
|
72
|
+
- silent fallback to alternate workflow definitions
|
|
73
|
+
- hidden discovery precedence rules that validation does not model
|
|
74
|
+
### Total
|
|
75
|
+
Validation must cover:
|
|
76
|
+
- every discoverable workflow file
|
|
77
|
+
- every resolved runtime workflow ID
|
|
78
|
+
- every workflow variant that runtime could select
|
|
79
|
+
### Exhaustive
|
|
80
|
+
Validation must report **all invalid workflows in one run**.
|
|
81
|
+
Stopping on the first failure is not acceptable for repository-wide validation.
|
|
82
|
+
### Explainable
|
|
83
|
+
Each failure must report:
|
|
84
|
+
- workflow ID
|
|
85
|
+
- resolved source file
|
|
86
|
+
- competing source files, if any
|
|
87
|
+
- validation phase that failed
|
|
88
|
+
- exact error message
|
|
89
|
+
- exact bad path, if available
|
|
90
|
+
- suggested fix
|
|
91
|
+
---
|
|
92
|
+
## Validation Phases
|
|
93
|
+
## Phase 1 — Discovery Validation
|
|
94
|
+
Validation must load the same workflow registry that runtime uses and verify:
|
|
95
|
+
- all discoverable workflow files are enumerated
|
|
96
|
+
- all runtime workflow IDs are enumerated
|
|
97
|
+
- source-to-ID mapping is explicit
|
|
98
|
+
- duplicate IDs are detected
|
|
99
|
+
- ambiguous resolution is detected
|
|
100
|
+
### Required rule
|
|
101
|
+
If multiple sources can satisfy the same runtime workflow ID and resolution is not explicitly deterministic and validated, validation fails.
|
|
102
|
+
## Phase 2 — Resolution Validation
|
|
103
|
+
For each runtime workflow ID, validation must determine:
|
|
104
|
+
- which exact source runtime would use
|
|
105
|
+
- why it won
|
|
106
|
+
- what competing candidates exist
|
|
107
|
+
### Required rule
|
|
108
|
+
Validation must validate the **resolved runtime target**, not just individual files.
|
|
109
|
+
## Phase 3 — Authored Definition Validation
|
|
110
|
+
Validation must check the authored workflow for:
|
|
111
|
+
- schema validity
|
|
112
|
+
- required fields
|
|
113
|
+
- duplicate step IDs
|
|
114
|
+
- prompt-source rules
|
|
115
|
+
- loop rules
|
|
116
|
+
- reference integrity
|
|
117
|
+
- function definition/call integrity
|
|
118
|
+
- condition shape
|
|
119
|
+
- confirmation rule shape
|
|
120
|
+
- validation criteria shape (including context-aware condition integrity on individual rules)
|
|
121
|
+
- output contract shape
|
|
122
|
+
- assessment ref integrity: every `assessmentRef` on every step must resolve to a declared workflow-level assessment
|
|
123
|
+
- assessment consequence shape: if `assessmentConsequences` is present, at least one `assessmentRef` must be declared; the `anyEqualsLevel` trigger value must exist in at least one dimension of at least one referenced assessment; at most one consequence per step
|
|
124
|
+
- structural workflow invariants
|
|
125
|
+
This layer catches bad authored input early, before normalization.
|
|
126
|
+
## Phase 4 — Executable Normalization Validation
|
|
127
|
+
Validation must prove the authored workflow can normalize into runtime executable form:
|
|
128
|
+
- template expansion
|
|
129
|
+
- feature expansion
|
|
130
|
+
- ref resolution
|
|
131
|
+
- promptBlocks resolution
|
|
132
|
+
- authoring-only field stripping or rejection
|
|
133
|
+
- runtime-only shape enforcement
|
|
134
|
+
### Required rule
|
|
135
|
+
If normalization fails, validation fails.
|
|
136
|
+
There must be no raw authored fallback for executable workflows.
|
|
137
|
+
## Phase 5 — Executable Schema Validation
|
|
138
|
+
The normalized executable workflow must pass the stricter runtime schema.
|
|
139
|
+
This schema must reject:
|
|
140
|
+
- authoring-only keys
|
|
141
|
+
- unsupported runtime shapes
|
|
142
|
+
- unresolved prompt sources
|
|
143
|
+
- illegal runtime confirmation shapes
|
|
144
|
+
- any field runtime cannot faithfully execute
|
|
145
|
+
## Phase 6 — Compilation Validation
|
|
146
|
+
Validation must prove the executable workflow compiles into runtime structures successfully:
|
|
147
|
+
- step graph
|
|
148
|
+
- loop graph
|
|
149
|
+
- step lookup map
|
|
150
|
+
- loop-body resolution
|
|
151
|
+
- condition-source derivation
|
|
152
|
+
- output contracts
|
|
153
|
+
- assessment consequence compilation: all referenced assessments resolve, trigger levels are reachable across the combined dimension set, consequence effect kinds are supported
|
|
154
|
+
- any other runtime compilation artifacts
|
|
155
|
+
### Required rule
|
|
156
|
+
If compilation fails, validation fails.
|
|
157
|
+
## Phase 7 — Startability Validation
|
|
158
|
+
Validation must prove the resolved workflow can be started:
|
|
159
|
+
- initial execution state can be created
|
|
160
|
+
- first pending step is reachable
|
|
161
|
+
- no workflow-definition errors occur on the start path
|
|
162
|
+
### Required rule
|
|
163
|
+
If `start_workflow` would fail because of workflow shape, validation must fail first.
|
|
164
|
+
## Phase 8 — Lifecycle Executability Validation
|
|
165
|
+
Validation must prove the workflow can execute from start to finish under deterministic fixtures:
|
|
166
|
+
- start succeeds
|
|
167
|
+
- continue/advance succeeds
|
|
168
|
+
- terminal completion is reachable
|
|
169
|
+
- no workflow-definition/internal-shape error appears anywhere in the lifecycle
|
|
170
|
+
This is required for the strongest possible guarantee.
|
|
171
|
+
---
|
|
172
|
+
## Full-Workflow Execution Testing
|
|
173
|
+
## Goal
|
|
174
|
+
Static validity is necessary but not sufficient.
|
|
175
|
+
WorkRail should automatically test real workflow execution end-to-end.
|
|
176
|
+
## Required Harness
|
|
177
|
+
WorkRail should have a deterministic execution harness that:
|
|
178
|
+
1. starts a workflow by runtime ID
|
|
179
|
+
2. consumes pending steps
|
|
180
|
+
3. provides fixture-driven `output`, `context`, and approvals
|
|
181
|
+
4. advances the workflow repeatedly
|
|
182
|
+
5. verifies that terminal completion is reachable
|
|
183
|
+
6. fails on any workflow-definition or runtime-contract error
|
|
184
|
+
## Required Fixture Inputs
|
|
185
|
+
Each execution-tested workflow should define or be paired with:
|
|
186
|
+
- workflow ID
|
|
187
|
+
- required start inputs
|
|
188
|
+
- required workspace path, if any
|
|
189
|
+
- synthetic user answers
|
|
190
|
+
- synthetic step outputs
|
|
191
|
+
- branch-driving context values
|
|
192
|
+
- synthetic assessment artifacts for steps with `assessmentRefs` (one `wr.assessment` artifact per ref, with canonical dimension levels)
|
|
193
|
+
- expected terminal condition
|
|
194
|
+
## Required Execution Coverage
|
|
195
|
+
At minimum, each runnable workflow should have:
|
|
196
|
+
- one happy-path completion test
|
|
197
|
+
- one minimum-input path where applicable
|
|
198
|
+
- one branch/confirmation path where applicable
|
|
199
|
+
- one loop path where applicable
|
|
200
|
+
For higher-risk workflows, add:
|
|
201
|
+
- retry path
|
|
202
|
+
- alternate branch path
|
|
203
|
+
- degraded/edge input path
|
|
204
|
+
## Required Failure Policy
|
|
205
|
+
If a workflow cannot be driven to completion under deterministic fixtures because of workflow-definition, compilation, or execution-contract issues, it is invalid and must fail validation/CI.
|
|
206
|
+
---
|
|
207
|
+
## Merge-Gate Requirements
|
|
208
|
+
Validation must block merges if any of the following are true:
|
|
209
|
+
- any workflow file is schema-invalid
|
|
210
|
+
- any discoverable workflow is structurally invalid
|
|
211
|
+
- any runtime workflow ID is ambiguous
|
|
212
|
+
- any resolved workflow cannot normalize into executable form
|
|
213
|
+
- any executable workflow fails executable schema validation
|
|
214
|
+
- any executable workflow fails compilation
|
|
215
|
+
- any workflow fails startability validation
|
|
216
|
+
- any workflow fails full-lifecycle deterministic execution testing
|
|
217
|
+
There are no exceptions for “hidden” or “unused” workflows.
|
|
218
|
+
If it is discoverable, it must validate.
|
|
219
|
+
---
|
|
220
|
+
## Runtime Invariants
|
|
221
|
+
These must hold system-wide:
|
|
222
|
+
1. no invalid workflow may be discoverable without validation failing
|
|
223
|
+
2. no ambiguous workflow ID may exist in the runtime registry
|
|
224
|
+
3. no authored workflow may be pinned unless it normalized successfully
|
|
225
|
+
4. no executable workflow may be stored unless it passes executable schema validation
|
|
226
|
+
5. no executable workflow may be runnable unless it compiles
|
|
227
|
+
6. no workflow-definition error may first appear during user-visible execution
|
|
228
|
+
7. validation and runtime resolution must be identical
|
|
229
|
+
8. if runtime hits a workflow-definition failure, the validator is considered incomplete
|
|
230
|
+
---
|
|
231
|
+
## Reporting Requirements
|
|
232
|
+
Repository-wide validation must report **every** invalid workflow in one run.
|
|
233
|
+
For each runtime workflow ID, the report should include:
|
|
234
|
+
- workflow ID
|
|
235
|
+
- selected source path
|
|
236
|
+
- competing source paths
|
|
237
|
+
- discovery status
|
|
238
|
+
- authored validation status
|
|
239
|
+
- executable normalization status
|
|
240
|
+
- executable schema status
|
|
241
|
+
- compilation status
|
|
242
|
+
- startability status
|
|
243
|
+
- lifecycle execution status
|
|
244
|
+
For each failure, report:
|
|
245
|
+
- phase
|
|
246
|
+
- message
|
|
247
|
+
- path
|
|
248
|
+
- suggested fix
|
|
249
|
+
---
|
|
250
|
+
## Anti-Patterns That Must Be Eliminated
|
|
251
|
+
- validating files while runtime executes resolved IDs
|
|
252
|
+
- silently preferring one duplicate over another
|
|
253
|
+
- best-effort raw fallback for executable workflows
|
|
254
|
+
- passing validation but failing `start_workflow`
|
|
255
|
+
- passing `start_workflow` but failing later because of workflow-definition issues
|
|
256
|
+
- hiding invalid workflows from lists or validation output
|
|
257
|
+
- stopping repository validation at the first invalid workflow
|
|
258
|
+
- allowing precommit/CI to pass when any discoverable workflow is invalid
|
|
259
|
+
---
|
|
260
|
+
## Acceptance Criteria
|
|
261
|
+
This system is only “done” when all of the following are true:
|
|
262
|
+
1. `validate:workflows` validates the full runtime registry, not just files
|
|
263
|
+
2. validation reports all invalid workflows in a single run
|
|
264
|
+
3. duplicate/ambiguous workflow IDs are hard failures
|
|
265
|
+
4. the exact workflow runtime would execute has already passed validation
|
|
266
|
+
5. `start_workflow` cannot fail because the workflow definition is invalid
|
|
267
|
+
6. `continue_workflow` cannot fail because the workflow definition is invalid
|
|
268
|
+
7. full deterministic execution tests can run workflows from start to terminal completion
|
|
269
|
+
8. any workflow-definition failure observed during execution is treated as a validation bug
|
|
270
|
+
---
|
|
271
|
+
## One-Sentence Standard
|
|
272
|
+
**A WorkRail workflow is valid only if the exact runtime-resolved workflow ID can be deterministically discovered, normalized, compiled, started, advanced, and completed under automated validation before it is allowed to merge or execute for a user.**
|