@allpepper/task-orchestrator 1.2.0 → 1.2.1
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/package.json +1 -1
- package/src/repos/dependencies.ts +11 -4
package/package.json
CHANGED
|
@@ -122,7 +122,15 @@ export function createDependency(params: {
|
|
|
122
122
|
type: DependencyType;
|
|
123
123
|
entityType: DependencyEntityType;
|
|
124
124
|
}): Result<Dependency> {
|
|
125
|
-
|
|
125
|
+
let { fromEntityId, toEntityId, type, entityType } = params;
|
|
126
|
+
|
|
127
|
+
// Normalize IS_BLOCKED_BY → BLOCKS by swapping from/to.
|
|
128
|
+
// This keeps a single canonical form in the DB so all downstream
|
|
129
|
+
// queries only need to handle BLOCKS direction.
|
|
130
|
+
if (type === 'IS_BLOCKED_BY') {
|
|
131
|
+
[fromEntityId, toEntityId] = [toEntityId, fromEntityId];
|
|
132
|
+
type = 'BLOCKS' as DependencyType;
|
|
133
|
+
}
|
|
126
134
|
|
|
127
135
|
// Validate: no self-dependency
|
|
128
136
|
if (fromEntityId === toEntityId) {
|
|
@@ -149,11 +157,10 @@ export function createDependency(params: {
|
|
|
149
157
|
return err(`${entityType} not found: ${toEntityId}`, 'NOT_FOUND');
|
|
150
158
|
}
|
|
151
159
|
|
|
152
|
-
// Validate: no circular dependencies for BLOCKS
|
|
160
|
+
// Validate: no circular dependencies for BLOCKS type
|
|
161
|
+
// (IS_BLOCKED_BY is already normalized to BLOCKS above, RELATES_TO has no direction)
|
|
153
162
|
const isCircular = type === 'BLOCKS'
|
|
154
163
|
? hasCircularDependency(fromEntityId, toEntityId, entityType)
|
|
155
|
-
: type === 'IS_BLOCKED_BY'
|
|
156
|
-
? hasCircularDependency(toEntityId, fromEntityId, entityType)
|
|
157
164
|
: false;
|
|
158
165
|
|
|
159
166
|
if (isCircular) {
|