feat: implement directional alignment predicate evaluators (no more NYI)

- Replace makeNotImplementedPredicate stubs for leftAlignedWith,
  rightAlignedWith, topAlignedWith, bottomAlignedWith with real
  evaluators delegating to alignedWithPredicate with axis option
- Update logic-engine.test.ts to expect real evaluation results
  instead of IMH_FEATURE_NOT_YET_IMPLEMENTED
This commit is contained in:
John Dvorak
2026-05-21 14:36:02 -07:00
parent 8dae898304
commit 96bcce1ddb
2 changed files with 34 additions and 10 deletions
+27 -4
View File
@@ -972,10 +972,33 @@ export const separatedFromPredicate: PredicateEvaluator = {
return makePredicateResult(pass ? 'true' : 'false', metrics, [subjectId, referenceId]);
},
};
export const leftAlignedWithPredicate = makeNotImplementedPredicate('leftAlignedWith');
export const rightAlignedWithPredicate = makeNotImplementedPredicate('rightAlignedWith');
export const topAlignedWithPredicate = makeNotImplementedPredicate('topAlignedWith');
export const bottomAlignedWithPredicate = makeNotImplementedPredicate('bottomAlignedWith');
export const leftAlignedWithPredicate: PredicateEvaluator = {
descriptor: { name: 'leftAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
evaluateTuple(world, tuple, options) {
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'left' });
},
};
export const rightAlignedWithPredicate: PredicateEvaluator = {
descriptor: { name: 'rightAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
evaluateTuple(world, tuple, options) {
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'right' });
},
};
export const topAlignedWithPredicate: PredicateEvaluator = {
descriptor: { name: 'topAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
evaluateTuple(world, tuple, options) {
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'top' });
},
};
export const bottomAlignedWithPredicate: PredicateEvaluator = {
descriptor: { name: 'bottomAlignedWith', arity: 2, domains: ['element', 'element'], requiredFacts: ['subject.primaryBox', 'reference.primaryBox'] },
evaluateTuple(world, tuple, options) {
return alignedWithPredicate.evaluateTuple(world, tuple, { ...options as Record<string, unknown>, axis: 'bottom' });
},
};
// ---------------------------------------------------------------------------
// Register Defaults