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.
43 lines
1.7 KiB
Markdown
43 lines
1.7 KiB
Markdown
---
|
|
id: error/error-hierarchy
|
|
name: Implement typed error class hierarchy
|
|
status: pending
|
|
depends_on:
|
|
- setup/project-init
|
|
scope: narrow
|
|
risk: trivial
|
|
impact: phase
|
|
level: implementation
|
|
---
|
|
|
|
## Description
|
|
|
|
Implement the custom error classes in `src/error/index.ts` per [errors-validation.md](../../../docs/architecture/errors-validation.md). All errors extend `TaskgraphError` which extends `Error`. Each subclass adds typed fields for programmatic error recovery.
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] `src/error/index.ts` exports:
|
|
- `TaskgraphError extends Error` — base class
|
|
- `TaskNotFoundError extends TaskgraphError` with `taskId: string` field
|
|
- `CircularDependencyError extends TaskgraphError` with `cycles: string[][]` field
|
|
- `InvalidInputError extends TaskgraphError` with `field: string` and `message: string` fields
|
|
- `DuplicateNodeError extends TaskgraphError` with `taskId: string` field
|
|
- `DuplicateEdgeError extends TaskgraphError` with `prerequisite: string` and `dependent: string` fields
|
|
- [ ] Each error class sets `this.name` to the class name
|
|
- [ ] Each error class properly extends the prototype chain (`Object.setPrototypeOf(this, new.target.prototype)`)
|
|
- [ ] `InvalidInputError` supports construction from TypeBox `Value.Errors()` output (receives structured field/path/value info)
|
|
- [ ] `CircularDependencyError` receives `string[][]` where each inner array is an ordered cycle path
|
|
- [ ] Unit tests verifying: correct `instanceof` chain, field access, `.name` property, error messages
|
|
|
|
## References
|
|
|
|
- docs/architecture/errors-validation.md — error types, when each is thrown
|
|
- docs/architecture/api-surface.md — error documentation on specific methods
|
|
|
|
## Notes
|
|
|
|
> To be filled by implementation agent
|
|
|
|
## Summary
|
|
|
|
> To be filled on completion |