refactor(sdm): Global pass with refined 'External Only' SDM tags. Pruned redundant internal references and fixed indentation logic in injector. Verified full project compilation.
This commit is contained in:
+36
-27
@@ -2,9 +2,10 @@ from src.models import Ticket, Track, WorkerContext
|
||||
|
||||
def test_ticket_instantiation() -> None:
|
||||
"""
|
||||
Verifies that a Ticket can be instantiated with its required fields:
|
||||
id, description, status, assigned_to.
|
||||
"""
|
||||
|
||||
Verifies that a Ticket can be instantiated with its required fields:
|
||||
id, description, status, assigned_to.
|
||||
"""
|
||||
ticket_id = "T1"
|
||||
description = "Implement surgical code changes"
|
||||
status = "todo"
|
||||
@@ -23,8 +24,9 @@ def test_ticket_instantiation() -> None:
|
||||
|
||||
def test_ticket_with_dependencies() -> None:
|
||||
"""
|
||||
Verifies that a Ticket can store dependencies.
|
||||
"""
|
||||
|
||||
Verifies that a Ticket can store dependencies.
|
||||
"""
|
||||
ticket = Ticket(
|
||||
id="T2",
|
||||
description="Write code",
|
||||
@@ -36,9 +38,10 @@ def test_ticket_with_dependencies() -> None:
|
||||
|
||||
def test_track_instantiation() -> None:
|
||||
"""
|
||||
Verifies that a Track can be instantiated with its required fields:
|
||||
id, description, and a list of Tickets.
|
||||
"""
|
||||
|
||||
Verifies that a Track can be instantiated with its required fields:
|
||||
id, description, and a list of Tickets.
|
||||
"""
|
||||
ticket1 = Ticket(id="T1", description="Task 1", status="todo", assigned_to="a")
|
||||
ticket2 = Ticket(id="T2", description="Task 2", status="todo", assigned_to="b")
|
||||
track_id = "TRACK-1"
|
||||
@@ -57,16 +60,18 @@ def test_track_instantiation() -> None:
|
||||
|
||||
def test_track_can_handle_empty_tickets() -> None:
|
||||
"""
|
||||
Verifies that a Track can be instantiated with an empty list of tickets.
|
||||
"""
|
||||
|
||||
Verifies that a Track can be instantiated with an empty list of tickets.
|
||||
"""
|
||||
track = Track(id="TRACK-2", description="Empty Track", tickets=[])
|
||||
assert track.tickets == []
|
||||
|
||||
def test_worker_context_instantiation() -> None:
|
||||
"""
|
||||
Verifies that a WorkerContext can be instantiated with ticket_id,
|
||||
model_name, and messages.
|
||||
"""
|
||||
|
||||
Verifies that a WorkerContext can be instantiated with ticket_id,
|
||||
model_name, and messages.
|
||||
"""
|
||||
ticket_id = "T1"
|
||||
model_name = "gemini-2.0-flash-lite"
|
||||
messages = [
|
||||
@@ -84,26 +89,29 @@ def test_worker_context_instantiation() -> None:
|
||||
|
||||
def test_ticket_mark_blocked() -> None:
|
||||
"""
|
||||
Verifies that ticket.mark_blocked(reason) sets the status to 'blocked'.
|
||||
Note: The reason field might need to be added to the Ticket class.
|
||||
"""
|
||||
|
||||
Verifies that ticket.mark_blocked(reason) sets the status to 'blocked'.
|
||||
Note: The reason field might need to be added to the Ticket class.
|
||||
"""
|
||||
ticket = Ticket(id="T1", description="Task 1", status="todo", assigned_to="a")
|
||||
ticket.mark_blocked("Waiting for API key")
|
||||
assert ticket.status == "blocked"
|
||||
|
||||
def test_ticket_mark_complete() -> None:
|
||||
"""
|
||||
Verifies that ticket.mark_complete() sets the status to 'completed'.
|
||||
"""
|
||||
|
||||
Verifies that ticket.mark_complete() sets the status to 'completed'.
|
||||
"""
|
||||
ticket = Ticket(id="T1", description="Task 1", status="todo", assigned_to="a")
|
||||
ticket.mark_complete()
|
||||
assert ticket.status == "completed"
|
||||
|
||||
def test_track_get_executable_tickets() -> None:
|
||||
"""
|
||||
Verifies that track.get_executable_tickets() returns only 'todo' tickets
|
||||
whose dependencies are all 'completed'.
|
||||
"""
|
||||
|
||||
Verifies that track.get_executable_tickets() returns only 'todo' tickets
|
||||
whose dependencies are all 'completed'.
|
||||
"""
|
||||
# T1: todo, no deps -> executable
|
||||
t1 = Ticket(id="T1", description="T1", status="todo", assigned_to="a")
|
||||
# T2: todo, deps [T1] -> not executable (T1 is todo)
|
||||
@@ -125,11 +133,12 @@ def test_track_get_executable_tickets() -> None:
|
||||
|
||||
def test_track_get_executable_tickets_complex() -> None:
|
||||
"""
|
||||
Verifies executable tickets with complex dependency chains.
|
||||
Chain: T1 (comp) -> T2 (todo) -> T3 (todo)
|
||||
T4 (comp) -> T3
|
||||
T5 (todo) -> T3
|
||||
"""
|
||||
|
||||
Verifies executable tickets with complex dependency chains.
|
||||
Chain: T1 (comp) -> T2 (todo) -> T3 (todo)
|
||||
T4 (comp) -> T3
|
||||
T5 (todo) -> T3
|
||||
"""
|
||||
t1 = Ticket(id="T1", description="T1", status="completed", assigned_to="a")
|
||||
t2 = Ticket(id="T2", description="T2", status="todo", assigned_to="a", depends_on=["T1"])
|
||||
t3 = Ticket(id="T3", description="T3", status="todo", assigned_to="a", depends_on=["T2", "T4", "T5"])
|
||||
@@ -156,4 +165,4 @@ def test_track_get_executable_tickets_complex() -> None:
|
||||
# Now T3 should be executable
|
||||
executable = track.get_executable_tickets()
|
||||
executable_ids = sorted([t.id for t in executable])
|
||||
assert executable_ids == ["T3"]
|
||||
assert executable_ids == ["T3"]
|
||||
Reference in New Issue
Block a user