feat: add driving flag to relationship query responses
Add computed driving flag to all relationship queries (list_relationships, get_predecessors, get_successors). A relationship is marked as driving when the predecessor's early end date plus lag determines the successor's early start date. Changes: - Add early_start_date and early_end_date columns to activities schema - Parse early dates from TASK table in XER files - Implement is_driving_relationship() helper with 24hr tolerance for calendar gaps - Update all relationship queries to compute and return driving flag - Add contract and unit tests for driving flag functionality - Update spec, contracts, and documentation
This commit is contained in:
@@ -75,3 +75,22 @@ class TestGetPredecessorsContract:
|
||||
|
||||
assert "error" in result
|
||||
assert result["error"]["code"] == "NO_FILE_LOADED"
|
||||
|
||||
async def test_get_predecessors_includes_driving_flag(
|
||||
self, sample_xer_single_project: Path
|
||||
) -> None:
|
||||
"""get_predecessors includes driving flag for each predecessor."""
|
||||
from xer_mcp.tools.get_predecessors import get_predecessors
|
||||
from xer_mcp.tools.load_xer import load_xer
|
||||
|
||||
await load_xer(file_path=str(sample_xer_single_project))
|
||||
|
||||
# A1010 (2002) has one predecessor: A1000 (2001)
|
||||
result = await get_predecessors(activity_id="2002")
|
||||
|
||||
assert "predecessors" in result
|
||||
assert len(result["predecessors"]) >= 1
|
||||
# All predecessors should have a driving flag
|
||||
for pred in result["predecessors"]:
|
||||
assert "driving" in pred
|
||||
assert isinstance(pred["driving"], bool)
|
||||
|
||||
Reference in New Issue
Block a user