Files
flowgraph/tasks/schema-edge-attrs.md

43 lines
2.0 KiB
Markdown

---
id: schema/edge-attrs
name: Define edge attribute schemas (Operation, Triggered, Dependency, Template) and CallResult
status: completed
depends_on:
- schema/enums
- schema/node-attrs
scope: narrow
risk: low
impact: component
level: implementation
---
## Description
Define all edge attribute schemas and the CallResult schema. Edge schemas are mode-specific (they do NOT include the universal `edgeType` field — that's stored separately in graphology alongside the mode-specific attributes). TemplateNodeAttrs is a type alias for OperationNodeAttrs.
## Acceptance Criteria
- [ ] `src/schema/edge.ts` exports all edge schemas and types
- [ ] `OperationEdgeAttrs`: `compatible` (boolean), optional `detail` (string), optional `mismatches` (Array of {path, expected, actual})
- [ ] `TriggeredEdgeAttrs`: empty object `Type.Object({})`
- [ ] `DependencyEdgeAttrs`: empty object `Type.Object({})`
- [ ] `CallEdgeAttrs`: union type `TriggeredEdgeAttrs | DependencyEdgeAttrs` (discriminated by `edgeType` at runtime)
- [ ] `TemplateEdgeAttrs`: `edgeType` (union of "sequential" | "conditional"), optional `condition` (Unknown), optional `negated` (boolean), optional `dataFlow` (boolean with default false)
- [ ] `TemplateNodeAttrs`: type alias for `OperationNodeAttrs` (template nodes carry the same attributes as operation nodes)
- [ ] `CallResultSchema`: `status` (NodeStatusEnum), `output` (Unknown), optional `error` ({code, message, details?})
- [ ] `CallResult`: type alias via `Static<typeof CallResultSchema>`
- [ ] `src/schema/index.ts` re-exports all edge schemas, CallResult, and TemplateNodeAttrs
- [ ] Unit tests for each schema: valid/invalid shapes, optional fields
## References
- docs/architecture/schema.md — full edge attribute definitions, CallResultSchema, TemplateNodeAttrs, edge key conventions
- docs/architecture/workflow-templates.md — TemplateEdgeAttrs.condition semantics (string vs function)
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion