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
1344ddf437
Merge cost-benefit/dag-propagation: computeEffectiveP and workflowCost, 63 tests
...
# Conflicts:
# src/analysis/cost-benefit.ts
2026-04-27 12:56:15 +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
ef8451bb19
Merge graph/subgraph-and-validation: subgraph and validation methods, 43 tests
2026-04-27 12:47:07 +00:00
cedbf3098b
Merge analysis/bottlenecks: betweenness centrality bottlenecks, 20 tests
...
# Conflicts:
# test/analysis.test.ts
2026-04-27 12:46:12 +00:00
c3649256cc
feat(graph/subgraph-and-validation): implement subgraph and validation methods
...
- Add subgraph() method using graphology-operators.subgraph (ADR-007: internal-only edges)
- Add validateSchema() using TypeBox Value.Check/Value.Errors
- Add validateGraph() detecting cycles and dangling references
- Add validate() combining both validations
- Define ValidationError, GraphValidationError, AnyValidationError types in error module
- Add standalone validation functions in src/graph/validation.ts
- Export validation module from src/graph/index.ts
- Add 43 unit tests for subgraph filtering and validation
2026-04-27 12:41:51 +00:00
62e23b5989
feat(analysis/bottlenecks): implement bottlenecks function using graphology-metrics betweenness centrality
...
- Implements bottlenecks(graph: TaskGraph): BottleneckResult[] with normalized scores (0.0-1.0)
- Uses graphology-metrics centrality.betweenness with normalized: true
- Returns array sorted by score descending, includes all nodes (even score 0)
- Handles empty graph edge case (returns empty array)
- 20 unit tests covering: linear chain, star graph, independent nodes,
disconnected graph, diamond, empty graph, single node
2026-04-27 12:35:48 +00:00
8d1b478a8c
Merge analysis/critical-path: criticalPath and weightedCriticalPath, 20 tests
2026-04-27 12:34:51 +00:00
4fe8532176
feat(analysis/critical-path): implement criticalPath and weightedCriticalPath
...
Implement longest-path-in-DAG algorithms using topological order + dynamic programming.
- criticalPath(graph): finds unweighted longest path (each node = weight 1)
- weightedCriticalPath(graph, weightFn): finds path with highest cumulative weight
- Both throw CircularDependencyError on cyclic graphs
- Empty graph returns [], single-node graph returns [nodeId]
- 20 unit tests covering linear chains, diamonds, weighted variants, cyclic detection
2026-04-27 12:34:35 +00:00
37179bc1de
feat(analysis/parallel-groups): implement parallelGroups function with tests
2026-04-27 12:31:43 +00:00
b0d943f4e6
Merge graph/queries: 7 query methods with 45 tests
...
# Conflicts:
# src/graph/construction.ts
2026-04-27 12:13:15 +00:00
95c8146af7
Merge graph/construction: fromTasks, fromRecords, fromJSON, addTask, addDependency
...
# Conflicts:
# src/graph/construction.ts
2026-04-27 12:07:41 +00:00
98cc05d266
feat(graph/queries): implement query methods — hasCycles, findCycles, topologicalOrder, dependencies, dependents, taskCount, getTask
...
- hasCycles(): uses graphology-dag.hasCycle() as fast boolean check
- findCycles(): SCC pre-check + custom 3-color DFS for cycle path extraction
- topologicalOrder(): graphology-dag.topologicalSort + CircularDependencyError on cycle
- dependencies/dependents: inNeighbors/outNeighbors with TaskNotFoundError
- taskCount(): graph.order, getTask(): node attributes or undefined
- 45 unit tests covering all acceptance criteria
2026-04-27 12:00:17 +00:00
8d384a7b3e
feat(graph/construction): implement TaskGraph construction methods
...
- fromTasks: bulk import via serialized blob, orphan nodes for dangling refs,
DuplicateNodeError for duplicates, edge dedup, null→undefined stripping
- fromRecords: strict validation (TaskNotFoundError for dangling refs,
DuplicateEdgeError for duplicate edges), per-edge qualityRetention
- fromJSON: TypeBox Value.Check validation, InvalidInputError on schema failure,
orphan nodes preserved
- addTask: throws DuplicateNodeError if ID exists
- addDependency: throws TaskNotFoundError/DuplicateEdgeError, deterministic
edge keys per ADR-006, default qualityRetention 0.9
- taskInputToNodeAttrs: strips null→undefined for categorical fields,
drops non-graph fields (tags, assignee, due, created, modified)
- 47 new unit tests (304 total, all passing)
2026-04-27 11:59:56 +00:00
96e65079c2
Merge cost-benefit/ev-calculation: calculateTaskEv pure function with 30 tests
2026-04-27 11:54:10 +00:00
aabc9e2fb5
Merge graph/mutation: removeTask, removeDependency, updateTask, updateEdgeAttributes
2026-04-27 11:53:42 +00:00
95ef4b023b
Merge frontmatter/file-io-and-serialize: parseTaskFile, parseTaskDirectory, serializeFrontmatter
2026-04-27 11:53:13 +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
5adc712193
feat(graph/mutation): implement removeTask, removeDependency, updateTask, updateEdgeAttributes
2026-04-27 11:51:57 +00:00
6da0cb12ce
feat(frontmatter/file-io-and-serialize): implement parseTaskFile, parseTaskDirectory, and serializeFrontmatter
2026-04-27 11:51:34 +00:00
34e227464c
feat(graph/export): implement export() and toJSON() methods on TaskGraph
2026-04-27 11:49:11 +00:00
9ad0ec902c
Merge graph/taskgraph-class: TaskGraph class skeleton with DirectedGraph, edge keys, fromJSON
2026-04-27 11:30:57 +00:00
e155e1e08a
feat(graph/taskgraph-class): implement TaskGraph class skeleton with graphology DirectedGraph
2026-04-27 11:29:59 +00:00
412849501f
Merge frontmatter/parsing: parseFrontmatter with YAML 1.2, TypeBox validation, InvalidInputError
2026-04-27 11:28:09 +00:00
7401e4d056
feat(frontmatter/parsing): implement parseFrontmatter with YAML parsing and TypeBox validation
2026-04-27 11:26:55 +00:00
0613a190ce
feat(schema/numeric-methods-and-defaults): implement categorical numeric functions and resolveDefaults
2026-04-27 11:25:43 +00:00
30f20a9f26
Merge schema/graph-schemas: node/edge attribute schemas, SerializedGraph generic factory
...
# Conflicts:
# test/schema.test.ts
2026-04-27 11:11:07 +00:00
ec30c96671
Merge schema/input-schemas: TaskInput and DependencyEdge schemas with Nullable helper
2026-04-27 11:04:07 +00:00
d2eaa0dd77
feat(schema/graph-schemas): define TaskGraphNodeAttributes, TaskGraphEdgeAttributes, and SerializedGraph generic
...
Implements graph attribute schemas and the SerializedGraph generic factory
parameterized with <N, E, G> following the graphology JSON format.
- TaskGraphNodeAttributes: name + optional categorical enums (scope, risk,
impact, level, priority, status) — analysis-relevant metadata only
- TaskGraphNodeAttributesUpdate: Type.Partial(TaskGraphNodeAttributes)
- TaskGraphEdgeAttributes: optional qualityRetention number
- SerializedGraph<N, E, G>: generic factory for graphology JSON format
- TaskGraphSerialized: concrete instantiation with empty graph attributes
- No schema version field per spec
35 new tests covering validation, rejection, and compile-time type safety.
2026-04-27 11:03:07 +00:00
b415d8c86b
feat(schema/input-schemas): define TaskInput, DependencyEdge schemas and Nullable re-export
...
- Add TaskInput schema with all fields per architecture (id, name, dependsOn,
categorical fields as Optional(Nullable(...)), metadata fields)
- Add DependencyEdge schema with from, to, qualityRetention fields
- Re-export Nullable helper from task.ts for convenience
- Add type aliases: TaskInput, DependencyEdge via Static<typeof>
- Add 49 tests covering validation, nullable fields, edge cases, type correctness
2026-04-27 11:02:40 +00:00
e367215e43
feat(schema/result-types): define analysis result TypeBox schemas
2026-04-27 10:59:57 +00:00
8725a26b43
Merge setup/test-infrastructure: vitest config, shared fixtures, 30 tests passing
2026-04-27 10:49:01 +00:00
167dde68f4
feat(setup/test-infrastructure): configure Vitest with shared test fixtures and helpers
...
- Add test:coverage script and @vitest/coverage-v8 dev dependency
- Update vitest.config.ts with @/ path alias and v8 coverage config
- Create test/fixtures/graphs.ts with 5 fixture graphs (linearChain,
diamond, mixedCategory, cyclic, largeGraph) and createTaskGraph helper
- Expand graph.test.ts with 26 fixture validation tests
- 30 tests passing, CI-compatible output (vitest run)
2026-04-27 10:48:35 +00:00
196b044ca4
Merge schema/enums: 6 TypeBox enum schemas with type aliases, 21 tests
2026-04-27 10:10:44 +00:00
6003926807
feat(schema/enums): define TypeBox categorical enum schemas and type aliases
2026-04-27 10:08:28 +00:00
e4b5ac3d54
Merge frontmatter/splitter: splitFrontmatter function with 18 tests
2026-04-27 10:05:19 +00:00
15104ff10c
feat(frontmatter/splitter): implement splitFrontmatter function with tests
2026-04-27 10:04:31 +00:00
ce68271f4f
feat(error/error-hierarchy): implement typed error class hierarchy
...
- Add typed fields to all error subclasses (taskId, cycles, field, message, prerequisite, dependent)
- Set Object.setPrototypeOf(this, new.target.prototype) in all constructors
- Add InvalidInputError.fromTypeBoxError() static factory for TypeBox Value.Errors() output
- CircularDependencyError accepts string[][] for cycle paths
- 31 unit tests covering instanceof chain, field access, .name property, and error messages
2026-04-27 10:00:40 +00:00
bd8a7b06d0
feat(setup/project-init): initialize TypeScript ESM project skeleton
...
- package.json with @alkdev/taskgraph, ESM primary, CJS compat exports
- tsconfig.json targeting Node 18+, strict mode, declaration output
- All production deps: graphology suite, @alkdev/typebox, yaml
- Dev deps: typescript, vitest, @types/node
- src/ skeleton: schema, graph, analysis, frontmatter, error modules
- test/ directory with 5 placeholder test files
- .gitignore and vitest.config.ts
2026-04-27 09:54:01 +00:00