6 Commits

Author SHA1 Message Date
ff7b19bc2c Merge cost-benefit/risk-analysis: riskPath, riskDistribution, shouldDecomposeTask, 29 tests 2026-04-27 13:48:07 +00:00
9d2d1811ca feat(cost-benefit/risk-analysis): implement riskPath, riskDistribution, shouldDecomposeTask 2026-04-27 13:39:31 +00:00
b231fa9da0 feat(cost-benefit/workflow-cost): fix includeCompleted default to false per api-surface.md spec
The workflowCost function had includeCompleted defaulting to true, but
the api-surface.md specifies the default should be false. Fixed the
default and updated test suite to verify the correct default behavior
and add explicit test for includeCompleted: true opt-in case.

All 562 tests passing across 12 test files.
2026-04-27 13:21:04 +00:00
7bfcfecc7a feat(cost-benefit/dag-propagation): implement DAG-propagation effective probability computation
Implement computeEffectiveP internal helper and workflowCost public function
that captures the structural reality that upstream failures multiply downstream
damage, per ADR-004 and the Python research model.

- computeEffectiveP: computes pEffective from intrinsic probability + upstream
  propagation using inherited quality factors (parentP + (1-parentP) × qualityRetention)
- workflowCost: processes tasks in topological order, computes per-task EV with
  degraded effective probability, includes pIntrinsic/pEffective split
- Supports independent and dag-propagate modes
- Completed tasks excluded from results but propagate p=1.0 when includeCompleted: false
- Per-edge qualityRetention overrides defaultQualityRetention option
- Throws CircularDependencyError for cyclic graphs via topologicalOrder
- 30+ new tests covering chain compounding, diamond graph, mode comparison,
  completed task semantics, cycle detection, per-edge qualityRetention
2026-04-27 12:52:47 +00:00
6016e81162 feat(cost-benefit): implement calculateTaskEv pure function
Implement the core EV calculation: EV = p*C_success + (1-p)*C_fail
where C_success = scopeCost*impactWeight, C_fail = scopeCost*impactWeight + fallbackCost + timeLost*expectedRetries.

- expectedRetries = (1-p)/p when p>0, else 0 (geometric series)
- Caps expectedRetries at config.retries when retries > 0
- Multiplies final EV by config.valueRate when non-zero
- 30 unit tests covering formula, edge cases, and Python research model values
2026-04-27 11:51:59 +00:00
131e3e929b Decompose architecture into 28 atomic implementation tasks
Break the @alkdev/taskgraph architecture specs into dependency-ordered
implementation tasks across 8 component directories: setup, schema,
error, graph, analysis, cost-benefit, frontmatter, api, and review.
Each task has clear acceptance criteria referencing specific architecture
docs. Three review tasks serve as quality gates at critical junction
points (schemas-and-errors, graph-complete, complete-library). The
dependency graph is validated acyclic with 9 topological levels enabling
significant parallelism across independent work streams.
2026-04-27 08:30:05 +00:00